ComfyUI PNG to CivitAI JPG版本v1.0.0 (ID: 425511)

ComfyUI PNG to CivitAI JPG版本v1.0.0 (ID: 425511)

Turn your ComfyUI PNG images into JPG images with generation data and resource list that CivitAI understands.

Public Repository: https://gitlab.com/lanterieur/comfyui-png-to-civitai-jpg

Change Log:

v1.0.1: Fixed the issue with the prefix "ASCII" on the positive prompt.

ComfyUI PNG to CivitAI JPG

This CLI tool helps converting ComfyUI generated PNG images into JPG images embedding some generation data compatible with CivitAI. Developped and tested on Windows only.

Requirements

*See the last section.

Use

  1. Place the contents of this repository in your ComfyUI image output directory.

  2. Open prepare_for_civitai.js in a text editor and change the paths to the checkpoints, LoRAs and embedding folders.

  3. In CMD (or git bash) node prepare_for_civitai.js

  4. The CLI UI appears.

  5. Question 1: Path to the folder to process. Relative to the file. Enter to validate.

  6. Question 2: Prefix or Suffix method. Default is Prefix. The JPG files will be created with either a civitai_ prefix or a _civitai suffix. Enter to validate.

  7. The tool will make a new jpeg file for every PNG file in the folder. It will not check for previously processed files.

Example:

Note: These test images have empty negative prompts.

Create an image post, upload one of these images.

Click on the "GENERATION DATA" tag to open the "Image Details" panel.
Note: the "ASCII" string before the positive prompt is a known issue. See section below.

Optional Launcher

You may edit the launch_prepare_for_civitai.bat file to set the path to the directory you use. You may then double click the .bat file to start the tool.

You may prefer using a shortcut with the logo icon. You may create a Windows Shortcut to the .bat file. Set the logo.ico as icon for the Shortcut.

Known Issues & Limitations

  • Will not provide accurate generation data for complex workflows.

  • Will not aggregate information from multiple samplers, seeds, latents and checkpoints.

  • Will not take upscalers into account for width and height.

  • In most cases, it will take the value of the first occurrence of a key/node in the workflow JSON.

  • It will take the contents of the first two text clip nodes and assume the first to be positive and second to be negative. It will not look for alternative prompt inputs.

  • Strips the workflow (as designed).

  • Fixed The encoding name string "ASCII" appears before the comment and is prepended to the positive prompt in CivitAI.

hashes.txt files

To use this exact script, you will need three text files:

  • models/checkpoints/hashes.txt

  • models/embeddings/hashes.txt

  • models/loras/hashes.txt

These files act as plaintext databases for CivitAI autov2 hashes and modelversionid values, which are used to identify resources. I tell you how to format these files and how to get those values in the next sections:

why text files

I want to work offline, so I will not fetch the values from the CivitAI website or API.

I could have saved those hashes and ids in many other ways, some easier to handle in the script. I like dedicated files because I can add the values immediately after starting the download of the file.

Another option that may simplify the script a lot, if you plan to edit my script, is to store those values in the file name of resources. I'm not willing to have to wait for a model to finish downloading before renaming it, or, to collect the values in a text file to create the file name before saving.

If you go with the filename route, you will only need to parse your resource name instead of having to open the file text and parse for the model name.

how to get the hashes/ids?

Values are provided on CivitAI.com. Browse to a model page. Example: "https://civitai.com/models/133005"

  • AutoV2

    • Inside the "Details" table, line called "Hash", should display "AUTOV2" and the hash.

    • If you see another hash type like "SHA256", click the arrow button on the right to cycle through hashes.

  • modelVersionId (EDITED)

    • EDIT: NEW METHOD

      • Inside the "Details" table, line called "Air", should display a pattern like "civitai: NUMBER @ NUMBER". Example: "civitai:133005@357609"

      • The second number after the @ sign is the modelVersionID.

    • OLD METHOD

      • This value is not exposed.

      • On a computer, hover your mouse cursor on the download button.

      • Chrome will show the link on the bottom left corner of the window. In this example: "https://civitai.com/api/download/models/357609".

      • Alternatively, if the model has versions, displayed as buttons between the Model Name and the Details table, click on another version, then click back to the version you want, the link shown in the URL bar will now expose the modelversionid: "https://civitai.com/models/133005?modelVersionId=357609"

models/checkpoints/hashes.txt

Line Format: model_file_name_without_extension:civitai_autov2_hash:modelVersionId

Example

If your models/checkpoints directory contains two files:

  • dreamshaper_8LCM.safetensors

  • shataXLLCM_001.safetensors

Then your file will look like this:

1.5
dreamshaper_8LCM:A4F3E1526C:252914
SDXL
shataXLLCM_001:F10DF5008C:249273

models/embeddings/hashes.txt

Line Format: embedding file name without extension:civitai_autov2_hash

  • hashes.txt in your models/embeddings directory

Example

## SD1.5
# - fast negative
fastenegativev2:A7465E7CC2

models/loras/hashes.txt

Line Format: lora file name without extension:civitai_autov2_hash

  • hashes.txt in your models/loras directory

Example

1.5
SDXL
add-detail-xl:0D9BD1B873

描述:

训练词语:

名称: comfyuiPNGToCivitai_v100.zip

大小 (KB): 127

类型: Archive

Pickle 扫描结果: Success

Pickle 扫描信息: No Pickle imports

病毒扫描结果: Success

ComfyUI PNG to CivitAI JPG

ComfyUI PNG to CivitAI JPG

ComfyUI PNG to CivitAI JPG

资源下载
下载价格VIP专享
仅限VIP下载升级VIP
犹豫不决让我们错失一次又一次机会!!!
原文链接:https://1111down.com/1041574.html,转载请注明出处
由于网站升级,部分用户密码全部设置为111111,登入后自己修改, 并且VIP等级提升一级(包月提升至包季,包季提升到包年 包年提升至永久)
没有账号?注册  忘记密码?

社交账号快速登录