A Python package for generating images using Bing Image Creator powered by DALL-E 3.
pip install bing-image-creator
import asyncio
from bing_image_creator import BingImageCreator
async def main():
creator = BingImageCreator(cookies=["your_cookie_value"])
# Generate and get image URLs only
images = await creator.generate_images(
prompt="a cute cat playing with yarn",
model="dall-e-3"
)
print(images)
asyncio.run(main())
from bing_image_creator import BingImageCreator
creator = BingImageCreator(cookies=["your_cookie_value"])
images = creator.generate_images_sync(
prompt="a cute cat playing with yarn",
model="dall-e-3"
)
print(images)
To use this package, you need to provide Bing authentication cookies:
- Visit Bing Image Creator
- Log in to your account
- Open browser developer tools (F12)
- Navigate to Application > Cookies
- Find the
_U
cookie value - Use this value in the
cookies
parameter when initializingBingImageCreator
- ⚡ Asynchronous image generation
- 🎨 Support for DALL-E 3 model
- 🖼️ Multiple images per prompt
- 💾 Automatic image saving
- 🔄 Error handling and retries
Parameter | Type | Description | Default |
---|---|---|---|
prompt |
str | Text description of the desired image | Required |
model |
str | AI model to use | "dall-e-3" |
output_dir |
str | Directory path for saving images | None |
When saving images locally:
- File naming:
{prompt}_{index}{extension}
- Prompt is truncated to 50 characters
- Original extensions preserved (defaults to .jpg)
- Example:
a_cute_cat_playing_with_yarn_0.jpg
Returns a list of image URLs regardless of local saving.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.