Have you ever stumbled upon a cool AI-generated image and wondered about the prompt behind it? In this article will show various techniques to discover or recreate the prompts used for AI-generated images. Whether you're looking for direct methods or more elaborate strategies, the goal is to show the tools available to understand the creative process behind these digital artworks and potentially reproduce or draw inspiration from these.
Let's explore how to transform simple admiration into deep understanding and perhaps even a source of inspiration for your own creations.
Prompt and Metadata
There are essentially two ways to obtain the prompt of an image:
- Find the exact prompt and generation parameters in the image file's metadata.
- Guess the prompt using AI.
Metadata of an AI image is a set of information that describes or provides data about an image file and is contained directly within it. For images created with Stable Diffusion, this metadata often includes the image prompt and generation parameters (model, seed, sampler, etc.).
Extracting Image Metadata
PNG Info (Automatic1111)
Automatic1111 or Forge has a built-in tool to extract the prompt and parameters of an image generated with Stable Diffusion.
PNG Info (Web)
Linaqruf, creator of the AnimagineXL model, also offers a web version of PNG Info to retrieve metadata from images generated with A1111, ComfyUI, and other interfaces.
Alternatively, any tool capable of extracting image metadata can allow you to retrieve the parameters of an image. For example, you can use Jimpl, a free and very easy-to-use tool.
Guessing the Prompt
When the prompt is not directly available with the image, it's still possible to obtain a prompt capable of reproducing a similar image. This is the principle of Image to Prompt, which consists of converting an image into a textual description.
A solution for Image to Prompt is to use a CLIP Interrogator - an AI model capable of describing any images, whether AI-generated or not.
Interrogate CLIP in Automatic1111
The Automatic1111 web interface has a CLIP Interrogator tool directly integrated into the img2img tab.
CLIP Interrogator Extension (Automatic1111)
There's an extension that allows you to choose from different models: CLIP Interrogator ext.
Online CLIP Interrogator
It's also possible to use an online CLIP interrogator rather than going through Automatic1111. Hugging Face and Replicate both offer an online interface that allows you to upload an image and choose the CLIP model to use to generate the description.
Describe Functions
An alternative to CLIP Interrogators is to use the Describe function offered by several image generation tools.
Fooocus Describe
Here's how to use the Describe feature in Fooocus:
Midjourney Describe
If you're also a Midjourney user in addition to Stable Diffusion, know that it also has a Describe feature that you can use to get the prompt of an image.
Image to Prompt with ChatGPT
Finally, if you have a ChatGPT Plus subscription, you can also call on OpenAI's chatbot to analyze your image and get a prompt by following this method:
- Upload the image and ask ChatGPT to describe it.
- Then ask ChatGPT to write the prompt to generate the image with Stable Diffusion.
Improving Results
When trying to reproduce an image using Stable Diffusion by guessing its prompt, the tools presented above should not replace your knowledge and imagination. None are perfect, and it's quite possible that the proposed prompts are incomplete or even erroneous. Don't hesitate to modify and correct the prompts to make them better correspond to what you see in the image.
Also try to choose a model adapted to the image you want to obtain: There are different models for different types of images (anime, photo, illustration, etc.), so use one that suits your needs.
Remember that you can also use an image as a prompt. Our article on Fooocus image prompt shows how to use this technique to reproduce the style or colors of an image.
Cheers 🍻
Top comments (1)
Next time, remember to credit the author of the original post when you post a translation...
I guess copying is a form of compliment. So thank you for your interest.