Skip to main content

Python library to create Art with AI.

Project description

ImaginePy
Discord Banner 4
Python version Release Version

Features

  • 🎨 Turn words into art
  • 👓 Choose from an array of art styles
  • 🔧 Adjust your masterpiece with creative controls!
  • 📦 Stay ahead of the game with the ever-growing art library!
  • 🌇 Generate wallpapers
  • 🔎 Discover and explore similar artistic designs
  • This is refactored and improved version of the original from hyugogirubato

Installation

Note: Requires Python 3.7.0 or newer with PIP installed.

$ python setup.py install

You now have the imaginepy package installed.

PyPi Installation

pip install imaginepy

From Source Code

The following steps are instructions on download, preparing, and running the code under a Venv environment. You can skip steps 3-5 with a simple python setup.py install call instead, but you miss out on a wide array of benefits.

  1. git clone https://github.com/ItsCEED/Imaginepy
  2. cd Imaginepy
  3. python -m venv env
  4. source env/bin/activate
  5. python setup.py install

As seen in Step 5, running the imaginepy executable is somewhat different to a normal PIP installation. See Venv's Docs on various ways of making calls under the virtual-environment.

Usage

The following is a minimal example of using ImaginePy in a script. It gets the generated image from the text and increases the quality.

from imaginepy import Imagine
from imaginepy.constants import *


def main():
    imagine = Imagine()

    img_data = imagine.sdprem(
        prompt="Woman sitting on a table, looking at the sky, seen from behind",
        style=Style.NO_STYLE,
        ratio=Ratio.RATIO_16X9,
        negative="",
        seed=1000,
        cfg=16,
        model=Model.REALISTIC,
        asbase64=False  # default is false, putting it here as presentation.
    )

    if img_data is None:
        print("An error occurred while generating the image.")
        return

    img_data = imagine.upscale(img_data)

    if img_data is None:
        print("An error occurred while upscaling the image.")
        return

    try:
        with open("example.jpeg", mode="wb") as img_file:
            img_file.write(img_data)
    except Exception as e:
        print(f"An error occurred while writing the image to file: {e}")


if __name__ == "__main__":
    main()

Async version

import asyncio
from imaginepy import AsyncImagine
from imaginepy.constants import *


async def main():
    imagine = AsyncImagine()
    img_data = imagine.sdprem(
        prompt="Woman sitting on a table, looking at the sky, seen from behind",
        style=Style.NO_STYLE,
        ratio=Ratio.RATIO_16X9,
        negative="",
        seed=1000,
        cfg=16,
        model=Model.REALISTIC,
        asbase64=False  # default is false, putting it here as presentation.
    )

    if img_data is None:
        print("An error occurred while generating the image.")
        return

    img_data = await imagine.upscale(image=img_data)

    if img_data is None:
        print("An error occurred while upscaling the image.")
        return

    try:
        with open("example.png", mode="wb") as img_file:
            img_file.write(img_data)
    except Exception as e:
        print(f"An error occurred while writing the image to file: {e}")

    await imagine.close()


if __name__ == "__main__":
    asyncio.run(main())

Credit

  • Imagine Icon © Vyro AI & API
  • Original reverse and version by: hyugogirubato

License

GNU General Public License, Version 3.0

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

imaginepy-2.0.1.tar.gz (36.4 kB view details)

Uploaded Source

File details

Details for the file imaginepy-2.0.1.tar.gz.

File metadata

  • Download URL: imaginepy-2.0.1.tar.gz
  • Upload date:
  • Size: 36.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for imaginepy-2.0.1.tar.gz
Algorithm Hash digest
SHA256 05f26502cc4cf697ba85121ca8f04ba62b7a23a896e056c3e2740da95f3451fe
MD5 a2a8fa9fc54652d67f945551d189ae23
BLAKE2b-256 bef90469a47de15e6a64cfc4ffea4d2434145a42b379dfc5ef2cb32cd13494af

See more details on using hashes here.

Supported by

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