Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a70cbb0c8d | ||
|
|
b95499617e | ||
|
|
77095ee38b | ||
|
|
1e59445091 | ||
|
|
b3e66eb21c | ||
|
|
145fbbb158 | ||
|
|
7c215dde00 | ||
|
|
07a1a5314d | ||
|
|
ed6533422e | ||
|
|
278e32450f | ||
|
|
b248fcf346 | ||
|
|
4b35b41d08 | ||
|
|
af96defbe0 | ||
|
|
e8ca90fe35 | ||
|
|
659d35b9b8 | ||
|
|
ee54281e45 | ||
|
|
f94e130bef | ||
|
|
6ab1534e85 | ||
|
|
d960b6dbf1 | ||
|
|
0d0afd7f45 | ||
|
|
2069d0c4fc | ||
|
|
55a57a3b2e | ||
|
|
a2e6aff81c | ||
|
|
2af4a879b5 | ||
|
|
12b5178915 | ||
|
|
a4f5891079 | ||
|
|
9042867e97 | ||
|
|
5527096b53 | ||
|
|
9a84eb186b | ||
|
|
faeea1f73c | ||
|
|
e6cca92351 | ||
|
|
05c3553688 | ||
|
|
23b5afbc4f | ||
|
|
c2ac789c44 |
@@ -0,0 +1,20 @@
|
||||
name: Publish to Comfy registry
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@main
|
||||
with:
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
@@ -1,4 +1,45 @@
|
||||
# Change Log
|
||||
## v1.3.4
|
||||
> [!TIP]
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
> [!NOTE]
|
||||
> comfyui-prompt-reader-node is now published on the [Comfy Registry](https://www.comfyregistry.org/).
|
||||
|
||||
- Add `Any Converter` node #76 #78
|
||||
- Fix the input validation of the `Parameter Generator` node #89
|
||||
- Fix the input validation of the `Parameter Extractor` node #90
|
||||
- Fix the `Parameter Generator` unable to choose standard resolutions #82
|
||||
- Fix the `Prompt Saver` unable to correctly handle filenames containing `.` #80
|
||||
- Update the `Parameter Extractor` node to support parsing quoted parameters #87 @spagatticode
|
||||
- Update PyProject Toml - License #85 @haohaocreates
|
||||
|
||||
## v1.3.3
|
||||
> [!TIP]
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
> [!NOTE]
|
||||
> comfyui-prompt-reader-node is now published on the [Comfy Registry](https://www.comfyregistry.org/).
|
||||
|
||||
- Add pyproject.toml for Custom Node Registry #75 @haohaocreates
|
||||
|
||||
## v1.3.2
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
> the first image generated after switching to the new model will take more time to calculate the hash value,
|
||||
> but it will not affect the generation speed afterwards until the server is restarted.
|
||||
|
||||
- Add support for pasted images to the `Prompt Reader` node #64
|
||||
- Update core to [1.3.5](https://github.com/receyuki/stable-diffusion-prompt-reader/releases/tag/v1.3.5)
|
||||
- Update nodes.py save_images to have %width and %height #66 @COvert96
|
||||
- Update the `Prompt Reader` node to the new exception handling method
|
||||
|
||||
## v1.3.1
|
||||
> Starting from v1.3, to support auto-detection on Civitai, `calculate_model_hash` will be renamed as
|
||||
> `calculate_hash` and it will be enabled by default. Due to the addition of temporary storage of the model hash values,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div align="center">
|
||||
<img alt="icon" src="https://github.com/receyuki/stable-diffusion-prompt-reader/raw/master/sd_prompt_reader/resources/icon.png" width=20% height=20%>
|
||||
<img alt="icon" src="https://github.com/receyuki/stable-diffusion-prompt-reader/raw/master/sd_prompt_reader/resources/icon-cube.png" width=20% height=20%>
|
||||
<h1>SD Prompt Reader Node</h1>
|
||||
<a href="https://github.com/receyuki/comfyui-prompt-reader-node/blob/master/LICENSE">
|
||||
<img alt="GitHub" src="https://img.shields.io/github/license/receyuki/comfyui-prompt-reader-node"></a>
|
||||
@@ -28,22 +28,27 @@ additional metadata to ensure compatibility with metadata detection on websites
|
||||
|
||||
|
||||
## Supported Formats
|
||||
| | PNG | JPEG | WEBP | TXT* |
|
||||
|--------------------------------------------------------------------------|:---:|:----:|:----:|:----:|
|
||||
| [A1111's webUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) | ✅ | ✅ | ✅ | ✅ |
|
||||
| [Easy Diffusion](https://github.com/easydiffusion/easydiffusion) | ✅ | ✅ | ✅ | |
|
||||
| [StableSwarmUI](https://github.com/Stability-AI/StableSwarmUI)* | ✅ | ✅ | | |
|
||||
| [Fooocus-MRE](https://github.com/MoonRide303/Fooocus-MRE)* | ✅ | ✅ | | |
|
||||
| [InvokeAI](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [ComfyUI](https://github.com/comfyanonymous/ComfyUI)* | ✅ | | | |
|
||||
| [NovelAI](https://novelai.net/) | ✅ | | | |
|
||||
| [Draw Things](https://drawthings.ai/) | ✅ | | | |
|
||||
| Naifu(4chan) | ✅ | | | |
|
||||
| | PNG | JPEG | WEBP | TXT* |
|
||||
|----------------------------------------------------------------------------------------|:---:|:----:|:----:|:----:|
|
||||
| [A1111's webUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) | ✅ | ✅ | ✅ | ✅ |
|
||||
| [Easy Diffusion](https://github.com/easydiffusion/easydiffusion) | ✅ | ✅ | ✅ | |
|
||||
| [StableSwarmUI](https://github.com/Stability-AI/StableSwarmUI)* | ✅ | ✅ | | |
|
||||
| [StableSwarmUI (prior to 0.5.8-alpha)](https://github.com/Stability-AI/StableSwarmUI)* | ✅ | ✅ | | |
|
||||
| [Fooocus-MRE](https://github.com/MoonRide303/Fooocus-MRE)* | ✅ | ✅ | | |
|
||||
| [NovelAI (stealth pnginfo)](https://novelai.net/) | ✅ | | ✅ | |
|
||||
| [NovelAI (legacy)](https://novelai.net/) | ✅ | | | |
|
||||
| [InvokeAI](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [InvokeAI (prior to 2.3.5-post.2)](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [InvokeAI (prior to 1.15)](https://github.com/invoke-ai/InvokeAI) | ✅ | | | |
|
||||
| [ComfyUI](https://github.com/comfyanonymous/ComfyUI)* | ✅ | | | |
|
||||
| [Draw Things](https://drawthings.ai/) | ✅ | | | |
|
||||
| Naifu(4chan) | ✅ | | | |
|
||||
|
||||
See [SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader#supported-formats) for details
|
||||
|
||||
## Installation
|
||||
>While ZIP package is available, it is strongly recommended not to use it for installation.
|
||||
> [!NOTE]
|
||||
> While ZIP package is available, it is strongly recommended not to use it for installation.
|
||||
### Install and update via [ComfyUI Manager](https://github.com/ltdrdata/ComfyUI-Manager) (Recommended)
|
||||
Search for `SD Prompt Reader` in the ComfyUI Manager and install it.
|
||||
### Install manually
|
||||
@@ -76,9 +81,11 @@ It uses the Image Data Reader from the
|
||||
[standalone SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader),
|
||||
allowing it to support the same formats and receive updates along with the
|
||||
[SD Prompt Reader](https://github.com/receyuki/stable-diffusion-prompt-reader).
|
||||
- Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
to read image metadata correctly, it is recommended to embed the `Prompt Saver` Node within the workflow
|
||||
to ensure maximum compatibility.
|
||||
> [!IMPORTANT]
|
||||
> Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
> to read image metadata correctly, it is recommended to embed the `Prompt Saver` Node within the workflow
|
||||
> to ensure maximum compatibility.
|
||||
|
||||
<details>
|
||||
<summary><b>More Information</b></summary>
|
||||
|
||||
@@ -122,12 +129,13 @@ e.g. `sd_xl_base` will be matched with `SDXL\sd_xl_base.safetensors`, and vice v
|
||||
- The `Prompt Saver` Node will write additional metadata in the A1111 format to the output images
|
||||
to be compatible with any tools that support the A1111 format,
|
||||
including SD Prompt Reader and Civitai.
|
||||
Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
- Due to custom nodes and complex workflows potentially causing issues with SD Prompt Reader's ability
|
||||
to read image metadata correctly, it's recommended to embed this node within the workflow
|
||||
to ensure maximum compatibility.
|
||||
- Since it's not possible to directly extract metadata from `KSampler`, it's necessary to
|
||||
use the `Parameter Generator` Node to generate parameters and simultaneously output them to
|
||||
the `Prompt Saver` Node and `KSampler` Node.
|
||||
to ensure maximum compatibility.
|
||||
> [!TIP]
|
||||
> Since it's not possible to directly extract metadata from `KSampler`, it's necessary to
|
||||
> use the `Parameter Generator` Node to generate parameters and simultaneously output them to
|
||||
> the `Prompt Saver` Node and `KSampler` Node.
|
||||
|
||||
<details>
|
||||
<summary><b>More Information</b></summary>
|
||||
@@ -177,7 +185,9 @@ from the `%counter` in the built-in `Saver` node, it will count all image files
|
||||
- Since it's not possible to directly extract metadata from `KSampler`, it's necessary to
|
||||
use the `Parameter Generator` Node to generate parameters and simultaneously output them to both
|
||||
the `Prompt Saver` Node and `KSampler` Node.
|
||||
- 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/).
|
||||
> [!TIP]
|
||||
> 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/).
|
||||
|
||||
<details>
|
||||
<summary><b>More Information</b></summary>
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
VERSION = "1.3.1"
|
||||
VERSION = "1.3.4"
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
@@ -2,7 +2,7 @@
|
||||
@author: receyuki
|
||||
@title: SD Prompt Reader
|
||||
@nickname: SD Prompt Reader
|
||||
@description: ComfyUI node version of the SD Prompt Reader
|
||||
@description: The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader
|
||||
"""
|
||||
|
||||
|
||||
@@ -141,6 +141,8 @@ class SDPromptReader:
|
||||
def load_image(self, image, parameter_index):
|
||||
if image in SDPromptReader.files:
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
elif image.startswith("pasted/"):
|
||||
image_path = folder_paths.get_annotated_filepath(image)
|
||||
else:
|
||||
image_path = image
|
||||
i = Image.open(image_path)
|
||||
@@ -157,9 +159,8 @@ class SDPromptReader:
|
||||
file_path = Path(image_path)
|
||||
|
||||
with open(file_path, "rb") as f:
|
||||
try:
|
||||
image_data = ImageDataReader(f)
|
||||
except:
|
||||
image_data = ImageDataReader(f)
|
||||
if image_data.status.name == "COMFYUI_ERROR":
|
||||
output_to_terminal(ERROR_MESSAGE["complex_workflow"])
|
||||
return self.error_output(
|
||||
error_message=ERROR_MESSAGE["complex_workflow"],
|
||||
@@ -169,8 +170,7 @@ class SDPromptReader:
|
||||
height=i.height,
|
||||
filename=file_path.stem,
|
||||
)
|
||||
|
||||
if not image_data.tool:
|
||||
elif image_data.status.name in ["FORMAT_ERROR", "UNREAD"]:
|
||||
output_to_terminal(ERROR_MESSAGE["format_error"])
|
||||
return self.error_output(
|
||||
error_message=ERROR_MESSAGE["format_error"],
|
||||
@@ -290,6 +290,10 @@ class SDPromptReader:
|
||||
image_data = ImageDataReader(f)
|
||||
return image_data.props
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, image):
|
||||
return True
|
||||
|
||||
|
||||
class SDPromptSaver:
|
||||
model_hash_dict = {}
|
||||
@@ -353,11 +357,11 @@ class SDPromptSaver:
|
||||
"lora_name": any_type,
|
||||
"width": (
|
||||
"INT",
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 1},
|
||||
),
|
||||
"height": (
|
||||
"INT",
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 1, "min": 1, "max": MAX_RESOLUTION, "step": 1},
|
||||
),
|
||||
"positive": ("STRING", {"default": "", "multiline": True}),
|
||||
"negative": ("STRING", {"default": "", "multiline": True}),
|
||||
@@ -452,6 +456,8 @@ class SDPromptSaver:
|
||||
"%seed": seed,
|
||||
"%steps": steps,
|
||||
"%cfg": cfg,
|
||||
"%width": width,
|
||||
"%height": height,
|
||||
"%extension": extension,
|
||||
"%model": Path(model_name_real).stem,
|
||||
"%sampler": sampler_name_real,
|
||||
@@ -663,13 +669,13 @@ class SDPromptSaver:
|
||||
|
||||
@staticmethod
|
||||
def get_unique_filename(stem: Path, extension: str, output_folder: Path):
|
||||
file = stem.with_suffix(f".{extension}")
|
||||
file = stem.with_suffix(f"{stem.suffix}.{extension}")
|
||||
index = 0
|
||||
|
||||
while (output_folder / file).exists():
|
||||
index += 1
|
||||
new_stem = f"{stem}_{index}"
|
||||
file = Path(new_stem).with_suffix(f".{extension}")
|
||||
new_stem = Path(f"{stem}_{index}")
|
||||
file = new_stem.with_suffix(f"{new_stem.suffix}.{extension}")
|
||||
|
||||
return file
|
||||
|
||||
@@ -782,11 +788,11 @@ class SDParameterGenerator:
|
||||
),
|
||||
"width": (
|
||||
"INT",
|
||||
{"default": 512, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 512, "min": 16, "max": MAX_RESOLUTION, "step": 8},
|
||||
),
|
||||
"height": (
|
||||
"INT",
|
||||
{"default": 512, "min": 1, "max": MAX_RESOLUTION, "step": 8},
|
||||
{"default": 512, "min": 16, "max": MAX_RESOLUTION, "step": 8},
|
||||
),
|
||||
"batch_size": (
|
||||
"INT",
|
||||
@@ -965,6 +971,10 @@ class SDParameterGenerator:
|
||||
),
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, aspect_ratio):
|
||||
return True
|
||||
|
||||
|
||||
class SDPromptMerger:
|
||||
@classmethod
|
||||
@@ -1034,6 +1044,30 @@ class SDTypeConverter:
|
||||
)
|
||||
|
||||
|
||||
class SDAnyConverter:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {},
|
||||
"optional": {
|
||||
"any_type_input": (
|
||||
any_type,
|
||||
{"forceInput": True},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = (any_type,)
|
||||
|
||||
RETURN_NAMES = ("ANY_TYPE_OUTPUT",)
|
||||
|
||||
FUNCTION = "convert_any"
|
||||
CATEGORY = "SD Prompt Reader"
|
||||
|
||||
def convert_any(self, any_type_input: str = ""):
|
||||
return (any_type_input,)
|
||||
|
||||
|
||||
class SDBatchLoader:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
@@ -1188,17 +1222,20 @@ class SDParameterExtractor:
|
||||
|
||||
@staticmethod
|
||||
def parse_setting(settings):
|
||||
pattern = re.compile(r"([^:,]+):\s*\(([^)]+)\)|([^:,]+):\s*([^,]+)")
|
||||
pattern = re.compile(r"([^:,]+):\s*\(([^)]+)\)|([^:,]+):\s*\"([^\"]+)\"|([^:,]+):\s*([^,]+)")
|
||||
|
||||
matches = pattern.findall(settings)
|
||||
|
||||
result = {}
|
||||
for match in matches:
|
||||
key, value_paren, key_nonparen, value_nonparen = match
|
||||
if key:
|
||||
key = key.strip()
|
||||
key_paren, value_paren, key_quotes, value_quotes, key_nonparen, value_nonparen = match
|
||||
if key_paren:
|
||||
key = key_paren.strip()
|
||||
value = value_paren.strip()
|
||||
value = tuple(v.strip() for v in value.split(","))
|
||||
elif key_quotes:
|
||||
key = key_quotes.strip()
|
||||
value = value_quotes.strip()
|
||||
else:
|
||||
key = key_nonparen.strip()
|
||||
value = value_nonparen.strip()
|
||||
@@ -1206,6 +1243,10 @@ class SDParameterExtractor:
|
||||
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
def VALIDATE_INPUTS(s, parameter):
|
||||
return True
|
||||
|
||||
|
||||
class SDLoraLoader:
|
||||
def __init__(self):
|
||||
@@ -1296,6 +1337,7 @@ NODE_CLASS_MAPPINGS = {
|
||||
"SDParameterGenerator": SDParameterGenerator,
|
||||
"SDPromptMerger": SDPromptMerger,
|
||||
"SDTypeConverter": SDTypeConverter,
|
||||
"SDAnyConverter": SDAnyConverter,
|
||||
"SDBatchLoader": SDBatchLoader,
|
||||
"SDParameterExtractor": SDParameterExtractor,
|
||||
"SDLoraLoader": SDLoraLoader,
|
||||
@@ -1308,6 +1350,7 @@ NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"SDParameterGenerator": "SD Parameter Generator",
|
||||
"SDPromptMerger": "SD Prompt Merger",
|
||||
"SDTypeConverter": "SD Type Converter",
|
||||
"SDAnyConverter": "SD Any Converter",
|
||||
"SDBatchLoader": "SD Batch Loader",
|
||||
"SDParameterExtractor": "SD Parameter Extractor",
|
||||
"SDLoraLoader": "SD Lora Loader",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "comfyui-prompt-reader-node"
|
||||
description = "The ultimate solution for managing image metadata and multi-tool compatibility. ComfyUI node version of the SD Prompt Reader."
|
||||
version = "1.3.3"
|
||||
license = { text = "MIT License" }
|
||||
dependencies = ["piexif"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/receyuki/comfyui-prompt-reader-node"
|
||||
# Used by Comfy Registry https://comfyregistry.org
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "receyuki"
|
||||
DisplayName = "comfyui-prompt-reader-node"
|
||||
Icon = "https://raw.githubusercontent.com/receyuki/comfyui-prompt-reader-node/main/images/icon-400.png"
|
||||
Submodule stable_diffusion_prompt_reader updated: cc3c8b2b3d...1a499becb0
Reference in New Issue
Block a user