Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ecceb0175 | ||
|
|
00aabca362 | ||
|
|
aff17ccbf4 | ||
|
|
0a5bedf412 | ||
|
|
b68ed7d7fa | ||
|
|
61c0487744 | ||
|
|
b4df56f08a | ||
|
|
c5a8fed1e6 |
@@ -36,7 +36,10 @@ jobs:
|
||||
|
||||
- name: Extract Section
|
||||
id: extract_section
|
||||
run: sed -n '/## Installation/,/## Usage/ {/## Usage/!p;}' README.md > installation.md
|
||||
run: |
|
||||
tag_name="${{ env.TAG_NAME }}"
|
||||
sed -n "/## $tag_name/,/## /p" CHANGELOG.md | sed '$d' >> installation.md
|
||||
sed -n '/## Installation/,/## Usage/ {/## Usage/!p;}' README.md >> installation.md
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# Change Log
|
||||
## v1.0.1
|
||||
- Add a new file-naming mechanism to ensure naming uniqueness
|
||||
- Fix `%counter` overwriting existing images #11 #14
|
||||
- Fix the bug causing the `Prompt Saver` node fails to save images in jpg and webp formats #10
|
||||
- Use relative paths for js imports #12
|
||||
|
||||
## v1.0.0
|
||||
- Initial release
|
||||
@@ -109,7 +109,10 @@ the `Prompt Saver` Node and `KSampler`.
|
||||
| %sampler |
|
||||
| %scheduler |
|
||||
| %quality |
|
||||
|
||||
- `%counter` cannot be used for the `path`. This `%counter` is slightly different from the `%counter`
|
||||
in the built-in Saver node, it will count all image files in the `path`.
|
||||
- When the filename already exists, an index will be added at the end of the filename,
|
||||
e.g. `file.png, file_1.png, file_2.png`.
|
||||
- For the `date_format` and `time_format`, please refer to
|
||||
[strftime.org](https://strftime.org/) or [www.strfti.me](https://www.strfti.me/).
|
||||
|
||||
@@ -121,6 +124,7 @@ the `Prompt Saver` Node and `KSampler`.
|
||||
- Since it's not possible to directly extract metadata from `KSampler`, it is necessary to
|
||||
use the `Parameter Generator` Node to generate parameters and simultaneously output them to both
|
||||
the `Prompt Saver` Node and `KSampler`.
|
||||
- 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/).
|
||||
- The `model_version` and `aspect_ratio` are used only for calculating the optimal resolution of the selected model version
|
||||
under the chosen aspect ratio. The calculation method is based on the
|
||||
[Stability AI development documentation](https://platform.stability.ai/docs/features/api-parameters#about-dimensions)
|
||||
@@ -154,4 +158,4 @@ You can use the `Type Converter` Node to convert them into `STRING` type.
|
||||
- The SD Prompt Reader node is based on [ComfyUI Load Image With Metadata](https://github.com/tkoenig89/ComfyUI_Load_Image_With_Metadata)
|
||||
- The SD Prompt Saver node is based on [Comfy Image Saver](https://github.com/giriss/comfy-image-saver) & [Stable Diffusion Webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui)
|
||||
- The seed generator in the SD Parameter Generator is modified from [rgthree's Comfy Nodes](https://github.com/rgthree/rgthree-comfy#rgthrees-comfy-nodes)
|
||||
- A special thanks to [@alessandroperilli](https://github.com/alessandroperilli) and his [AP Workflow](https://perilli.com/ai/comfyui/) for providing numerous suggestions
|
||||
- A special thanks to [@alessandroperilli](https://github.com/alessandroperilli) and his [AP Workflow](https://perilli.com/ai/comfyui/) for providing numerous suggestions
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
VERSION = "1.0.0"
|
||||
VERSION = "1.0.1"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {app} from "/scripts/app.js";
|
||||
import {ComfyWidgets} from "/scripts/widgets.js";
|
||||
import {app} from "../../scripts/app.js";
|
||||
import {ComfyWidgets} from "../../scripts/widgets.js";
|
||||
|
||||
// Create a read-only string widget
|
||||
function createWidget(app, node, widgetName, type) {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import {app} from "/scripts/app.js";
|
||||
import {ComfyWidgets} from "/scripts/widgets.js";
|
||||
import {app} from "../../scripts/app.js";
|
||||
import {ComfyWidgets} from "../../scripts/widgets.js";
|
||||
|
||||
// Create a read-only string widget with opacity set
|
||||
function createWidget(app, node, widgetName) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
import os
|
||||
from datetime import datetime
|
||||
from itertools import chain
|
||||
|
||||
import torch
|
||||
import json
|
||||
@@ -293,7 +294,7 @@ class SDPromptSaver:
|
||||
(
|
||||
full_output_folder,
|
||||
filename_alt,
|
||||
counter,
|
||||
counter_alt,
|
||||
subfolder_alt,
|
||||
filename_prefix,
|
||||
) = folder_paths.get_save_image_path(
|
||||
@@ -316,7 +317,6 @@ class SDPromptSaver:
|
||||
variable_map = {
|
||||
"%date": self.get_time(date_format),
|
||||
"%time": self.get_time(time_format),
|
||||
"%counter": f"{counter:05}",
|
||||
"%seed": seed,
|
||||
"%steps": steps,
|
||||
"%cfg": cfg,
|
||||
@@ -327,6 +327,12 @@ class SDPromptSaver:
|
||||
"%quality": jpg_webp_quality,
|
||||
}
|
||||
|
||||
subfolder = self.get_path(path, variable_map)
|
||||
output_folder = Path(full_output_folder) / subfolder
|
||||
output_folder.mkdir(parents=True, exist_ok=True)
|
||||
counter = self.get_counter(output_folder)
|
||||
variable_map["%counter"] = f"{counter:05}"
|
||||
|
||||
i = 255.0 * image.cpu().numpy()
|
||||
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||
metadata = None
|
||||
@@ -348,10 +354,9 @@ class SDPromptSaver:
|
||||
f"Version: ComfyUI"
|
||||
f"{extra_info_real}"
|
||||
)
|
||||
subfolder = self.get_path(path, variable_map)
|
||||
output_folder = Path(full_output_folder) / subfolder
|
||||
output_folder.mkdir(parents=True, exist_ok=True)
|
||||
file = self.get_path(filename, variable_map).with_suffix("." + extension)
|
||||
|
||||
stem = self.get_path(filename, variable_map)
|
||||
file = self.get_unique_filename(stem, extension, output_folder)
|
||||
|
||||
if extension == "png":
|
||||
if not args.disable_metadata:
|
||||
@@ -383,11 +388,10 @@ class SDPromptSaver:
|
||||
},
|
||||
}
|
||||
)
|
||||
piexif.insert(metadata, str(file))
|
||||
piexif.insert(metadata, str(output_folder / file))
|
||||
results.append(
|
||||
{"filename": file.name, "subfolder": str(subfolder), "type": self.type}
|
||||
)
|
||||
counter += 1
|
||||
|
||||
return {"ui": {"images": results}}
|
||||
|
||||
@@ -403,6 +407,13 @@ class SDPromptSaver:
|
||||
|
||||
return hash_sha256.hexdigest()[:10]
|
||||
|
||||
@staticmethod
|
||||
def get_counter(directory: Path):
|
||||
img_files = list(
|
||||
chain(*(directory.rglob(f"*{suffix}") for suffix in SUPPORTED_FORMATS))
|
||||
)
|
||||
return len(img_files) + 1
|
||||
|
||||
@staticmethod
|
||||
def get_path(name, variable_map):
|
||||
for variable, value in variable_map.items():
|
||||
@@ -418,6 +429,18 @@ class SDPromptSaver:
|
||||
except:
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
def get_unique_filename(stem: Path, extension: str, output_folder: Path):
|
||||
file = stem.with_suffix(f".{extension}")
|
||||
index = 0
|
||||
|
||||
while (output_folder / file).exists():
|
||||
index += 1
|
||||
new_stem = f"{stem}_{index}"
|
||||
file = Path(new_stem).with_suffix(f".{extension}")
|
||||
|
||||
return file
|
||||
|
||||
|
||||
class SDParameterGenerator:
|
||||
ASPECT_RATIO_MAP = {
|
||||
|
||||
Reference in New Issue
Block a user