mirror of
https://github.com/justUmen/Bjornulf_custom_nodes.git
synced 2026-03-26 06:45:44 -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
|
# Dependencies
|
||||||
|
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
- **v0.16**: Big changes on Character Description Generator
|
- **v0.16**: Big changes on Character Description Generator
|
||||||
- **v0.17**: New loop node, combine by lines.
|
- **v0.17**: New loop node, combine by lines.
|
||||||
- **v0.18**: New loop node, Free VRAM hack
|
- **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
|
# 📝 Nodes descriptions
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "bjornulf_custom_nodes"
|
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, ..."
|
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"}
|
license = {file = "LICENSE"}
|
||||||
|
|
||||||
[project.urls]
|
[project.urls]
|
||||||
|
|||||||
@@ -25,6 +25,15 @@ class SaveImageToFolder:
|
|||||||
os.makedirs(output_dir, exist_ok=True)
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
|
|
||||||
results = []
|
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:
|
for image in images:
|
||||||
i = 255. * image.cpu().numpy()
|
i = 255. * image.cpu().numpy()
|
||||||
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
|
||||||
@@ -36,15 +45,10 @@ class SaveImageToFolder:
|
|||||||
for k, v in extra_pnginfo.items():
|
for k, v in extra_pnginfo.items():
|
||||||
metadata.add_text(k, json.dumps(v))
|
metadata.add_text(k, json.dumps(v))
|
||||||
|
|
||||||
counter = 1
|
filename = os.path.join(output_dir, f"{counter:05d}.png")
|
||||||
while True:
|
|
||||||
filename = os.path.join(output_dir, f"{counter:05d}.png")
|
|
||||||
if not os.path.exists(filename):
|
|
||||||
break
|
|
||||||
counter += 1
|
|
||||||
|
|
||||||
img.save(filename, format="PNG", pnginfo=metadata)
|
img.save(filename, format="PNG", pnginfo=metadata)
|
||||||
print(f"Image saved as: {filename}")
|
print(f"Image saved as: {filename}")
|
||||||
results.append({"filename": filename})
|
results.append({"filename": filename})
|
||||||
|
counter += 1
|
||||||
|
|
||||||
return {"ui": {"images": [{"filename": filename, "type": "output"}]}}
|
return {"ui": {"images": [{"filename": filename, "type": "output"}]}}
|
||||||
Reference in New Issue
Block a user