The Stable Diffusion AI in Python version

5/5 - (42 votes)

I have previously discussed with you about Stable Diffusion, and today, I would like to introduce you to another program called ImaginAIry. This program is a Python script that utilizes StableDiffusion and enables users to generate images directly from the command line. However, to use ImaginAIry, you will need to have a computer with decent performance and at least 10 GB of free storage to download the necessary models.

To install ImaginAIry, open a terminal and enter the following command:

pip3 install imaginairy

Then, to generate your image, it’s simple, just call ImaginAIry like this, putting in quotes, all the images you need:

imagine "A picture of an Icelandic landscape" "A picture of a Hitler cat" "A picture of a smart troll" "A picture of a hunter threatened by a rabbit

The initial setup of ImaginAIry might take a while as it needs to download all the necessary models for image generation. However, subsequent runs will be faster, depending on the processing power of your computer. The output quality will depend on both Stable Diffusion’s capabilities and the quality of your input prompts.

ImaginAIry offers a wide range of parameters that allow you to customize your images by adding or removing elements. Additionally, you can modify existing images by using the masking feature, where you can remove elements and create variations of the original image. For instance, you can take a picture of the Mona Lisa, remove her hair, and transform her into a President Mona Lisa or a Doctor Mona Lisa.

Here is the command used to do that:

imagine --init-image 5449.jpg --mask-prompt "face AND NOT hair" --mask-mode keep --init-image-strength .2 --fix-faces "a modern female president" "a female doctor

The –fix-faces option is also interesting since it allows you to “fix” faces, especially glitches in the eyes.

You can also do image enlargement without loss of quality (upscaling)

imagine "Laurent in jail" --steps 40 --upscale

And many other cool things. We can for example do the opposite and let the AI ​​describe what it sees on an image. To do this, run the “aimg” command and enter this:

describe CHEMIN-VERS-IMAGE.jpg

As ImaginAIry is a Python script, you can also use it as a library in your own scripts. Although it may not produce images of the same quality as Midjourney, with the right keywords and a lot of time, it is still possible to generate impressive results. Integrating ImaginAIry into your scripts can also offer some interesting possibilities, such as image understanding and tagging, or the creation of avatars and other types of images.

To discover here.

Mohamed SAKHRI

my name is Mohamed SAKHRI, and I am the creator and editor-in-chief of Easy Tech Tutorials. As a passionate technology enthusiast, I have been blogging for some time now, providing practical and helpful guides for various operating systems such as Windows, Linux, and macOS, as well as Android tips and tricks. Additionally, I also write about WordPress. I am currently 35 years old.

Leave a Comment