Skip to main content

Asynchronous AI image generation library with proxy support.

Project description

ImageGenToolKit

ImageGenToolKit is a Python library for asynchronous AI image generation with built-in proxy support. This library uses the MagicHour AI platform and handles proxies automatically, making it ideal for generating images in environments with restricted or rate-limited access.

Features

  • Asynchronous: Fully async operations for speed and scalability.
  • Proxy Support: Automatically fetches and rotates HTTP proxies.
  • Customizable: Allows prompt-based image generation with configurable orientation.

Installation

Install the library using pip:

pip install ImageGenToolKit

Usage

Here’s how to use the library to generate AI-generated images.

Basic Example

import asyncio
from ImageGenToolKit import AIImageGeneratorAsync

async def main(): # Initialize the image generator gen = AIImageGeneratorAsync()

# Generate an image
prompt = "A futuristic cityscape with glowing neon lights"
urls = await gen.generate_image(prompt, orientation="landscape")

# Print the image URLs
print("Generated Image URLs:", urls)

Run the async function

asyncio.run(main())

Output Example

Generated Image URLs: [
    "https://example.com/image1.png",
    "https://example.com/image2.png"
]

Customizing Orientation

You can specify the orientation as "portrait", "landscape", or "square":

urls = await gen.generate_image("A serene mountain lake", orientation="portrait")

Advanced Features

Handling Proxies

The library automatically fetches and uses proxies. You can also fetch proxies manually if needed:

await gen.fetch_proxies()
print(gen.proxy_list)  # List of fetched proxies

Error Handling

Make sure to handle exceptions in case of network issues or invalid proxies:

try:
    urls = await gen.generate_image("A fantasy dragon in flight")
    print(urls)
except Exception as e:
    print("Error generating image:", e)

Contributing

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature-name.
  3. Commit your changes: git commit -m "Add new feature".
  4. Push to the branch: git push origin feature-name.
  5. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Feel free to reach out with any questions or suggestions! рџљЂ

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ImageGenToolKit-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ImageGenToolKit-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file ImageGenToolKit-0.1.0.tar.gz.

File metadata

  • Download URL: ImageGenToolKit-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.0

File hashes

Hashes for ImageGenToolKit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8b06699411fe9d05d4dc618426d7c4376938d977df4c5588b432c492f7223632
MD5 6028e5051c0048a1ac2d3d3a2fa58818
BLAKE2b-256 2e8ddbc1c2f2524bf44456b7c31fef2f849bc4a3a4c26046635f44c84522c89e

See more details on using hashes here.

File details

Details for the file ImageGenToolKit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ImageGenToolKit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f47123e017a35c6dd0b2b51936671cdc22a1be56e819178e51587f8c72837ff
MD5 3778521cf1e3051d1e6faec29c8ee466
BLAKE2b-256 c041e7e8491f70c25ce8b513b74d5b907635712cbe405b573639bcadf1ac294a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page