mirror of
https://github.com/justUmen/Bjornulf_custom_nodes.git
synced 2026-03-21 20:52:11 -03:00
0.19
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# 🔗 Comfyui : Bjornulf_custom_nodes v0.18 🔗
|
||||
# 🔗 Comfyui : Bjornulf_custom_nodes v0.19 🔗
|
||||
|
||||
# Dependencies
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
- **v0.16**: Big changes on Character Description Generator
|
||||
- **v0.17**: New loop node, combine by lines.
|
||||
- **v0.18**: New loop node, Free VRAM hack
|
||||
- **v0.19**: Changes for save to folder node : ignore missing images filenames, will use the highest number found + 1.
|
||||
|
||||
# 📝 Nodes descriptions
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "bjornulf_custom_nodes"
|
||||
description = "Nodes: Ollama, Text to Speech, Save image for Bjornulf LobeChat, Text with random Seed, Random line from input, Combine images (Background+Overlay alpha), Image to grayscale (black & white), Remove image Transparency (alpha), Resize Image, ..."
|
||||
version = "0.18"
|
||||
version = "0.19"
|
||||
license = {file = "LICENSE"}
|
||||
|
||||
[project.urls]
|
||||
|
||||
@@ -25,6 +25,15 @@ class SaveImageToFolder:
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
results = []
|
||||
|
||||
# Find the highest existing file number
|
||||
existing_files = [f for f in os.listdir(output_dir) if f.endswith('.png') and f[:5].isdigit()]
|
||||
if existing_files:
|
||||
highest_num = max(int(f[:5]) for f in existing_files)
|
||||
counter = highest_num + 1
|
||||
else:
|
||||
counter = 1
|
||||
|
||||
for image in images:
|
||||
i = 255. * image.cpu().numpy()
|
||||
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||
@@ -36,15 +45,10 @@ class SaveImageToFolder:
|
||||
for k, v in extra_pnginfo.items():
|
||||
metadata.add_text(k, json.dumps(v))
|
||||
|
||||
counter = 1
|
||||
while True:
|
||||
filename = os.path.join(output_dir, f"{counter:05d}.png")
|
||||
if not os.path.exists(filename):
|
||||
break
|
||||
counter += 1
|
||||
|
||||
filename = os.path.join(output_dir, f"{counter:05d}.png")
|
||||
img.save(filename, format="PNG", pnginfo=metadata)
|
||||
print(f"Image saved as: {filename}")
|
||||
results.append({"filename": filename})
|
||||
counter += 1
|
||||
|
||||
return {"ui": {"images": [{"filename": filename, "type": "output"}]}}
|
||||
Reference in New Issue
Block a user