ghost
Sign In

How to upload InvokeAI generated images with automatic metadata recognition

How to upload InvokeAI generated images with automatic metadata recognition

26th July 2024 Update: Released a new version which supports in-painted images, by auto-extracting metadata from the original image which was in-painted

23rd July 2024 Update: Released a new version which can auto-calculate the sha256 hashes from model files on disk

Background

I actually love InvokeAI more than Automatic1111 WebUI, because the interface is much more streamlined, user-friendly and it "just works". But unfortunately Civitai doesn't recognize metadata from images generated with InvokeAI. I've searched high & low online for a workaround, but surprisingly wasn't able to find any.

So in the end, I've written a script to convert InvokeAI metadata format to Automatic1111 format so that Civitai can recognize them.

You can get it here: Invoke-Civitai

How to Use

Prerequisites

  • Python (ideally v3.10 and above)

  • InvokeAI (of course!)

Option 1: Setup InvokeAI to calculate model hashes in sha256

  1. Go to the folder where InvokeAI is installed

  2. Open the file invokeai.yaml in a text editor

  3. Add the line hashing_algorithm: 'sha256' so the invokeai.yaml file will look something like below:

  4. !! IMPORTANT !! Remove all installed models (including LoRAs and VAEs if any), and install them again

InvokeAI by default saves model hashes using BLAKE3 algorithm, while Automatic1111 saves them using sha256. As these hashing algorithms are designed to be unidirectional, it's practically impossible to reverse-engineer a BLAKE3 back to the original form and convert it to a sha256 hash.

Option 2: Setup config file to point to model folders

  1. Open invokeai_cfg.json in a text editor

  2. Change the values of model_folder, vae_folder and lora_folder to the actual locations on your PC where these model files are stored

!! IMPORTANT !! Change any backslashes (\) to forward slashes (/) when entering the model paths

For example, let's say your checkpoint models are stored in C:\sd\stable-diffusion-webui\models\Stable-Diffusion, VAE models in C:\sd\stable-diffusion-webui\models\VAE and LoRA models in C:\sd\stable-diffusion-webui\models\Lora.
Then change the invokeai_cfg.json file like so:

Support for In-painted Images

  1. Similar to the instructions for Option 2, open invokeai_cfg.json in a text editor

  2. Change the value of invokeai_output_folder to the actual location on your PC where InvokeAI stores image outputs. It is typically \outputs\images under the folder where InvokeAI is installed.

For example:

Usage Instructions

  1. Download the latest release of invoke-civitai, and unzip to a new folder

  2. Drag & Drop the images you want to convert to the converter.bat file

  3. That's it! The converted images will be saved in the same folder as the original, with _a1111 appended to the file name
    e.g. if the original filename was 1234.png, the converted filename will be 1234_a1111.png

Now you can upload the converted images to Civitai, and all parameters and models (including LoRAs) used by the image will automagically be filled in by Civitai upon upload.

Feel free to contact me (either on Civitai or on Github) if you face any issues with the converter, or if you have any suggestions.

4

Comments