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.1.tar.gz (5.5 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.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ImageGenToolKit-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 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.1.tar.gz
Algorithm Hash digest
SHA256 a0dacaed5804d9a77f1d2efdca998789caea0b2446e0c6eb53e7c208327ff2ab
MD5 54f8aa0c96e25580ada82fd23cd6dd7d
BLAKE2b-256 8d3fcec43e662f482c58002eae3984738fbb959c0b820bf6618fc5591e2bf382

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ImageGenToolKit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9da3448713aebcf8b81717fa8591bbcf6f04a99e1f0c52d0cdb5cadaaf2ac6fc
MD5 a4f4b36ce8392663e51c8da5bce3d8d9
BLAKE2b-256 77b490248f7d47c873d2c54750fbb7aa6050679a17a0f27236318a6c8c281b57

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