{"id":23233420,"url":"https://github.com/receyuki/comfyui-prompt-reader-node","last_synced_at":"2025-05-05T02:52:08.121Z","repository":{"id":195622279,"uuid":"691194929","full_name":"receyuki/comfyui-prompt-reader-node","owner":"receyuki","description":"The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader","archived":false,"fork":false,"pushed_at":"2025-02-01T13:57:48.000Z","size":18792,"stargazers_count":315,"open_issues_count":41,"forks_count":29,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T14:35:07.231Z","etag":null,"topics":["comfyui","comfyui-workflow","prompt-engineering","prompt-toolkit","stable-diffusion","stable-diffusion-webui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/receyuki.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-13T17:25:00.000Z","updated_at":"2025-01-30T18:58:57.000Z","dependencies_parsed_at":"2023-10-27T20:23:29.855Z","dependency_job_id":"e08c4345-8948-4d6a-ab26-06056367ea44","html_url":"https://github.com/receyuki/comfyui-prompt-reader-node","commit_stats":null,"previous_names":["receyuki/comfyui-prompt-reader-node"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/receyuki%2Fcomfyui-prompt-reader-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/receyuki%2Fcomfyui-prompt-reader-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/receyuki%2Fcomfyui-prompt-reader-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/receyuki%2Fcomfyui-prompt-reader-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/receyuki","download_url":"https://codeload.github.com/receyuki/comfyui-prompt-reader-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252429953,"owners_count":21746571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comfyui","comfyui-workflow","prompt-engineering","prompt-toolkit","stable-diffusion","stable-diffusion-webui"],"created_at":"2024-12-19T03:01:38.423Z","updated_at":"2025-05-05T02:52:08.113Z","avatar_url":"https://github.com/receyuki.png","language":"Python","funding_links":[],"categories":["Workflows (3395) sorted by GitHub Stars","All Workflows Sorted by GitHub Stars"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg alt=\"icon\" src=\"https://github.com/receyuki/stable-diffusion-prompt-reader/raw/master/sd_prompt_reader/resources/icon-cube.png\" width=20% height=20%\u003e\n    \u003ch1\u003eSD Prompt Reader Node\u003c/h1\u003e\n    \u003ca href=\"https://github.com/receyuki/comfyui-prompt-reader-node/blob/master/LICENSE\"\u003e\n        \u003cimg alt=\"GitHub\" src=\"https://img.shields.io/github/license/receyuki/comfyui-prompt-reader-node\"\u003e\u003c/a\u003e\n    \u003cimg alt=\"GitHub tag (with filter)\" src=\"https://img.shields.io/github/v/tag/receyuki/comfyui-prompt-reader-node?label=node\"\u003e\n    \u003ca href=\"https://github.com/receyuki/stable-diffusion-prompt-reader\"\u003e    \n        \u003cimg alt=\"GitHub tag (with filter)\" src=\"https://img.shields.io/github/v/tag/receyuki/stable-diffusion-prompt-reader?label=core\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/psf/black\"\u003e\n        \u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n    \u003cbr\u003e\n\nThis is a subproject of the \n\u003ca href=\"https://github.com/receyuki/stable-diffusion-prompt-reader\"\u003eSD Prompt Reader.\u003c/a\u003e\nIt helps you extract metadata from images in any format supported by the \n\u003ca href=\"https://github.com/receyuki/stable-diffusion-prompt-reader\"\u003eSD Prompt Reader\u003c/a\u003e and saves the images with \nadditional metadata to ensure compatibility with metadata detection on websites such as Civitai.\n    \u003cbr\u003e\n  \u003cp\u003e\n    \u003ca href=\"#supported-formats\"\u003eSupported Formats\u003c/a\u003e •\n    \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n    \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e •\n    \u003ca href=\"./CHANGELOG.md\"\u003eChange Log\u003c/a\u003e •\n    \u003ca href=\"#credits\"\u003eCredits\u003c/a\u003e\n  \u003c/p\u003e\n    \u003cimg src=\"./images/screenshot_v130.png\"\u003e\n\u003c/div\u003e\n\n\n## Supported Formats\n|                                                                                        | PNG | JPEG | WEBP | TXT* |\n|----------------------------------------------------------------------------------------|:---:|:----:|:----:|:----:|\n| [A1111's webUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui)               |  ✅  |  ✅   |  ✅   |  ✅   |\n| [Easy Diffusion](https://github.com/easydiffusion/easydiffusion)                       |  ✅  |  ✅   |  ✅   |      |\n| [StableSwarmUI](https://github.com/Stability-AI/StableSwarmUI)*                        |  ✅  |  ✅   |      |      |\n| [StableSwarmUI (prior to 0.5.8-alpha)](https://github.com/Stability-AI/StableSwarmUI)* |  ✅  |  ✅   |      |      |\n| [Fooocus-MRE](https://github.com/MoonRide303/Fooocus-MRE)*                             |  ✅  |  ✅   |      |      |\n| [NovelAI (stealth pnginfo)](https://novelai.net/)                                      |  ✅  |      |  ✅   |      |\n| [NovelAI (legacy)](https://novelai.net/)                                               |  ✅  |      |      |      |\n| [InvokeAI](https://github.com/invoke-ai/InvokeAI)                                      |  ✅  |      |      |      |\n| [InvokeAI (prior to 2.3.5-post.2)](https://github.com/invoke-ai/InvokeAI)              |  ✅  |      |      |      |\n| [InvokeAI (prior to 1.15)](https://github.com/invoke-ai/InvokeAI)                      |  ✅  |      |      |      |\n| [ComfyUI](https://github.com/comfyanonymous/ComfyUI)*                                  |  ✅  |      |      |      |\n| [Draw Things](https://drawthings.ai/)                                                  |  ✅  |      |      |      |\n| Naifu(4chan)                                                                           |  ✅  |      |      |      |\n\nSee [SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader#supported-formats) for details\n\n## Installation\n\u003e [!NOTE]\n\u003e While ZIP package is available, it is strongly recommended not to use it for installation.\n### Install and update via [ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Manager) (Recommended)\nSearch for `SD Prompt Reader` in the ComfyUI Manager and install it.\n### Install manually\nPlease make sure to install the submodules along with the main repository.\n1. `cd` to the `custom_node` folder\n2. Clone this repo\n    ```shell\n    git clone --recursive https://github.com/receyuki/comfyui-prompt-reader-node.git\n    ```\n3. Install dependencies\n    ```shell\n    cd comfyui-prompt-reader-node\n    pip install -r requirements.txt\n    ```\n#### Update\nWhen updating, don't forget to include the submodules along with the main repository.\n```shell\ngit pull --recurse-submodules\n```\n\n## Usage\n### Prompt Reader Node\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/reader.png\" width=\"25%\" height=\"25%\" alt=\"reader node\"\u003e\n\u003c/div\u003e\n\n- The `Prompt Reader` Node works exactly the same as the \n[standalone SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader). \nIt uses the Image Data Reader from the \n[standalone SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader), \nallowing it to support the same formats and receive updates along with the \n[SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader).\n\u003e [!IMPORTANT]\n\u003e Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability \n\u003e to read image metadata correctly, it is recommended to embed the `Prompt Saver` Node within the workflow \n\u003e to ensure maximum compatibility.\n\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eMore Information\u003c/b\u003e\u003c/summary\u003e\n\n#### `parameter_index`\n- For images containing multiple sets of parameters, such as those processed through `hires-fix` or `refiner`, \nyou will need to modify the `parameter_index` to select the parameters you need\n#### SDXL\n- For images generated by SDXL and containing multiple sets of prompts, \nthe `text_g` will be combined with `text_l` into a single prompt\n#### Batch Read\n- For batch processing, please use the `Batch Loader` node. When using the `Batch Loader` node for bulk reading, \nthe preview image will not update, and the text box will only display the metadata of the last image.\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/loader2reader.png\" width=\"50%\" height=\"50%\" alt=\"connect batch loader to prompt reader\"\u003e\n\u003c/div\u003e\n\n#### Additional Parameters\n- To read parameters other than the existing output, please connect the `settings` to the `Parameter Extractor` node.\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/reader2extractor.png\" width=\"50%\" height=\"50%\" alt=\"connect prompt reader to parameter extractor\"\u003e\n\u003c/div\u003e\n\n#### `MODEL_NAME`\n- `MODEL_NAME` is a special output that matches the model name in the metadata with the existing models on the server \naccording to the following priority:\n  1. Identical path, filename, and extension.\n  2. Identical filename, and extension. \ne.g. `sd_xl_base.safetensors` will be matched with `SDXL\\sd_xl_base.safetensors`, and vice versa.\n  3. Identical filename.\ne.g. `sd_xl_base` will be matched with `SDXL\\sd_xl_base.safetensors`, and vice versa.\n  4. If a matching model cannot be found, the original name will be outputted.\n\n\u003c/details\u003e\n\n### Prompt Saver Node\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/saver.png\" width=\"25%\" height=\"25%\" alt=\"saver node\"\u003e\n\u003c/div\u003e\n\n- The `Prompt Saver` Node and the `Parameter Generator` Node are designed to be used together.  \n- The `Prompt Saver` Node will write additional metadata in the A1111 format to the output images \nto be compatible with any tools that support the A1111 format, \nincluding SD Prompt Reader and Civitai. \n- Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability \nto read image metadata correctly, it's recommended to embed this node within the workflow \nto ensure maximum compatibility.\n\u003e [!TIP]\n\u003e Since it's not possible to directly extract metadata from `KSampler`, it's necessary to \n\u003e use the `Parameter Generator` Node to generate parameters and simultaneously output them to \n\u003e the `Prompt Saver` Node and `KSampler` Node.\n\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eMore Information\u003c/b\u003e\u003c/summary\u003e\n\n#### Image Format\n- Only PNG format supports embedding both metadata and workflow at the same time. Other formats can only embed metadata.\n#### Duplicate Filename\n- When the filename already exists, an index will be added at the end of the filename, \ne.g. `file.png, file_1.png, file_2.png`.\n#### Hashes \u0026 Auto-Detection on Civitai\n- When `calculate_hash` is enabled, the node will compute the hash values of checkpoint, VAE, Lora, \nand embedding/Textual Inversion, and write them into the metadata. After the server restarts, or a new checkpoint, \nVAE, Lora, or embedding/Textual Inversion is loaded, the first image generation may take a longer time for hash calculation. \nThe hash value will be stored in temporary storage without the need for repeated calculation, \nuntil the server is restarted.\n- When `resource_hash` is enabled, the resource hashes will be written into the metadata to support auto-detection \non Civitai. This function will only run when `calculate_hash` is enabled.\n- If you need to calculate the hash of Lora, please use the `Lora Loader` Node or the `Lora Selector` Node. \nThe hash value of the embedding/Textual Inversion will be automatically detected from the prompt.\n#### `save_metadata_file`\n- When the `save_metadata_file` is turned on, the metadata will be saved as a TXT file with the same name\nalongside the image.\n#### `date_format` \u0026 `time_format`\n- For the `date_format` and `time_format`, please refer to \n[strftime.org](https://strftime.org/) or [www.strfti.me](https://www.strfti.me/).\n#### `filename` \u0026 `path`\n- `%counter` cannot be used for `path`, it can only be used for `filename`. This `%counter` is slightly different \nfrom the `%counter` in the built-in `Saver` node, it will count all image files in the `path`.\n- Please refer to the following table for placeholders supported by the `filename` and `path`.\n\n   |            |            |\n   |------------|------------|\n   | %seed      | %date      |\n   | %steps     | %time      |\n   | %cfg       | %counter   |\n   | %model     | %extension |\n   | %sampler   | %quality   |\n   | %scheduler |            |\n\n\u003c/details\u003e\n\n### Parameter Generator Node\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/generator.png\" width=\"25%\" height=\"25%\" alt=\"generator node\"\u003e\n\u003c/div\u003e\n\n- Since it's not possible to directly extract metadata from `KSampler`, it's necessary to \nuse the `Parameter Generator` Node to generate parameters and simultaneously output them to both \nthe `Prompt Saver` Node and `KSampler` Node.\n\u003e [!TIP]\n\u003e The `Parameter Generator` Node can also be used as a control panel for complex ComfyUI workflows, just like the [AP workflow](https://perilli.com/ai/comfyui/).\n\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eMore Information\u003c/b\u003e\u003c/summary\u003e\n\n#### Optimal Resolution\n- The `model_version` and `aspect_ratio` are used only for calculating the optimal resolution of the selected \nmodel version under the chosen aspect ratio. The calculation method is based on the \n[Stability AI development documentation](https://platform.stability.ai/docs/features/api-parameters#about-dimensions) \nand the [StableSwarmUI source code](https://github.com/Stability-AI/StableSwarmUI) (developed by Stability AI).\n#### `refiner_start`\n- `refiner_start` refers to the proportion of steps completed when the refiner starts running, \ni.e., the proportion of base steps to total steps. This is used to calculate the `start_at_step` (`REFINER_START_STEP`)\nrequired by the refiner `KSampler` under the selected step ratio.\n\n\u003c/details\u003e\n\n### Batch Loader Node\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/loader.png\" width=\"25%\" height=\"25%\" alt=\"loader node\"\u003e\n\u003c/div\u003e\n\n- The `Batch Loader` Node is specifically designed for the `Prompt Reader` Node to batch-read image files in a directory \nand cannot be used with other custom nodes.\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eMore Information\u003c/b\u003e\u003c/summary\u003e\n\n- For batch processing, please connect the `IMAGE` output of the `Batch Loader` Node to the `image` input of \nthe `Prompt Reader` Node.\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/loader2reader.png\" width=\"50%\" height=\"50%\" alt=\"connect prompt reader to parameter extractor\"\u003e\n\u003c/div\u003e\n\n#### `path`\n- The `path` supports relative paths such as `./input/` or absolute paths like `C:/Users/receyuki/Pictures`.\n- Both `\\ ` and `/` are acceptable.\n- You can also input a single file or a list of files into the `path`, \nin which case the `image_load_limit` and `start_index` will not function.\n\n\u003c/details\u003e\n\n### Parameter Extractor Node\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/extractor.png\" width=\"25%\" height=\"25%\" alt=\"extractor node\"\u003e\n\u003c/div\u003e\n\n- The `Parameter Extractor` Node is an extension of the `Prompt Reader` Node, designed to retrieve the values \nof all parameters in the settings (including those parameters that the `Prompt Reader` Node cannot output). \ne.g. `Hires  upscaler`\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eMore Information\u003c/b\u003e\u003c/summary\u003e\n\n- Connect the `SETTINGS` of the `Prompt Reader` Node to the `settings` of the `Parameter Extractor` Node. \nAfter the first run, the parameter list will be loaded.\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/reader2extractor.png\" width=\"50%\" height=\"50%\" alt=\"connect prompt reader to parameter extractor\"\u003e\n\u003c/div\u003e\n\u003c/details\u003e\n\n### Prompt Merger Node \u0026 Type Converter Node\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/merger_converter.png\" width=\"25%\" height=\"25%\" alt=\"merger and converter node\"\u003e\n\u003c/div\u003e\n\n- Since the A1111 format cannot store `text_g` and `text_l` separately, SDXL users need to use \nthe `Prompt Merger` Node to combine `text_g` and `text_l` into a single prompt.\n- Since `model_name`, `sampler_name`, and `scheduler` are special types \nthat cannot be directly used by some other nodes,\nYou can use the `Type Converter` Node to convert them into `STRING` type.\n\n### Lora Loader Node \u0026 Lora Selector Node\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./images/lora.png\" width=\"50%\" height=\"50%\" alt=\"lora loader and selector node\"\u003e\n\u003c/div\u003e\n\n- The `Lora Loader` Node and `Lora Selector` Node are used to write Lora data into metadata and support auto-detection\non Civitai. \n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eMore Information\u003c/b\u003e\u003c/summary\u003e\n\n- Replace the original loader with the `Lora Loader` Node, or connect the `LORA_NAME` output of the `Lora Selector` Node\nto the `lora_name` input of other lora loaders (built-in or custom), and link the `NEXT_LORA` output to the `lora_name` \ninput of the `Prompt Saver` Node. Both of these nodes have the same function, please choose according to your needs.\n#### Multiple Loras\n- If you need to load multiple Loras, please connect the `Lora Loader` Node or `Lora Selector` Node head to tail \nthrough `last_lora` and `NEXT_LORA`, and connect the `NEXT_LORA` at the end of the Lora chain to the `lora_name` input \nof the `Prompt Saver` Node.\n1. Lora Loader chain\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./images/lora_loader_chain.png\" width=\"100%\" height=\"100%\" alt=\"lora loader chain\"\u003e\n\u003c/div\u003e\n\n2. Lora Selector chain\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"./images/lora_selector_chain.png\" width=\"100%\" height=\"100%\" alt=\"lora loader chain\"\u003e\n\u003c/div\u003e\n\n\u003c/details\u003e\n\n### Example Workflow\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eSimple Example\u003c/b\u003e\u003c/summary\u003e\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./workflows/simple_example.png\" width=\"100%\" height=\"100%\" alt=\"example workflow\"\u003e\n\u003c/div\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eLora Example\u003c/b\u003e\u003c/summary\u003e\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./workflows/lora_example.png\" width=\"100%\" height=\"100%\" alt=\"example workflow\"\u003e\n\u003c/div\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eHires-fix Example\u003c/b\u003e\u003c/summary\u003e\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./workflows/hires_fix_example.png\" width=\"100%\" height=\"100%\" alt=\"example workflow\"\u003e\n\u003c/div\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003e\u003cb\u003eSDXL Example\u003c/b\u003e\u003c/summary\u003e\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"./workflows/sdxl_example.png\" width=\"100%\" height=\"100%\" alt=\"example workflow\"\u003e\n\u003c/div\u003e\n\u003c/details\u003e\n\n\n## Credits\n- The SD Prompt Reader node is based on [ComfyUI Load Image With Metadata](https://github.com/tkoenig89/ComfyUI_Load_Image_With_Metadata)\n- The SD Prompt Saver node is based on [Comfy Image Saver](https://github.com/giriss/comfy-image-saver) \u0026 [Stable Diffusion Webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui)\n- The seed generator in the SD Parameter Generator is modified from [rgthree's Comfy Nodes](https://github.com/rgthree/rgthree-comfy#rgthrees-comfy-nodes)\n- A special thanks to [@alessandroperilli](https://github.com/alessandroperilli) and his [AP Workflow](https://perilli.com/ai/comfyui/) for providing numerous suggestions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freceyuki%2Fcomfyui-prompt-reader-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freceyuki%2Fcomfyui-prompt-reader-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freceyuki%2Fcomfyui-prompt-reader-node/lists"}