Compare commits

..
7 Commits
Author SHA1 Message Date
Eric 01b16c7056 Merge pull request #38 from rea-ducks/main
Fixing ckpt_name includes subfolder path, issue #36
2024-12-01 12:35:43 -07:00
Reah Ducks 13e7ccf849 Fixing ckpt_name includes subfolder path, issue #36 in upstream 2024-11-01 16:30:23 +01:00
Eric 3ca7d02f3d Merge pull request #26 from rainlizard/patch-1
Update README.md for correct usage of ./ in foldername_keys
2024-09-06 19:37:03 -07:00
rainlizard e32bb26b51 Update README.md for correct usage of ./ 2024-09-07 12:03:33 +10:00
Eric ff4e4f9ba8 Merge pull request #17 from ComfyNodePRs/licence-update
Update PyProject Toml - License
2024-09-06 17:26:18 -07:00
snomiao 75c8fdd886 chore(licence-update): Update PyProject Toml - License 2024-07-31 18:03:26 +00:00
audioscavenger bf91779271 release 2.76 resolution
modified:   README.md
	modified:   pyproject.toml
	modified:   save_image_extended.py
2024-06-27 11:28:01 -07:00
3 changed files with 25 additions and 14 deletions
+4 -1
View File
@@ -26,7 +26,7 @@ Supports those extensions: **JXL AVIF WebP jpg jpeg j2k jp2 png gif tiff bmp**
| `filename_prefix` | String prefix added to files. |
| `filename_keys` | Comma separated string with sampler parameters to add to filename. E.g: `sampler_name, scheduler, cfg, denoise` Added to filename in written order. `resolution` also works. `vae_name` `model_name` (upscale model), `ckpt_name` (checkpoint) are others that should work. Here you can try any parameter name of any node. As long as the parameter has the same variable name defined in the `prompt` object they should work. The same applies to `foldername_keys`. |
| `foldername_prefix` | String prefix added to folders. |
| `foldername_keys` | Comma separated string with _sampler_ parameters to add to foldername. Add more subfolders by prepending "./" to the key name. |
| `foldername_keys` | Comma separated string with _sampler_ parameters to add to foldername. Add more subfolders by writing a "./" separated with commas. For example: `sampler_name, ./, ckpt_name` |
| `delimiter` | **now a free field** Delimiter = 1 character, can be anything your file system supports. Windows users should still use "/" for subfolders. |
| `save_job_data` | If enabled, saves information about each job as entries in a `jobs.json` text file, inside the generated folder. Mulitple options for saving `prompt`, `basic data`, `sampler settings`, `loaded models`. |
| `job_data_per_image` | When enabled, saves individual job data files for each image. |
@@ -184,6 +184,9 @@ TODO:
- [ ] keep same counter if extension changes?
- [ ] files will be out of order if prefixes change... that is expected, but is this what we want?
### release 2.76 💾
- brought back resolution
### release 2.75 💾
- Prefix each value by its key name: prefix-seed=123456-width=1024-etc-0001.avif
+2 -2
View File
@@ -1,8 +1,8 @@
[project]
name = "save-image-extended-comfyui"
description = "Save as JXL, AVIF, WebP, JPEG, JPEG2k, customize the folder, sub-folders, and filenames of your images!"
version = "2.75"
license = "LICENCE"
version = "2.76"
license = { file = "LICENSE" }
dependencies = ["piexif", "imagecodecs", "pillow", "pillow-avif-plugin", "pillow-jxl-plugin"]
[project.urls]
+19 -11
View File
@@ -11,7 +11,7 @@ import pprint
import piexif
import piexif.helper
version = 2.75
version = 2.76
avif_supported = False
jxl_supported = False
@@ -253,13 +253,19 @@ ComfyUI can only load PNG and WebP at the moment, AVIF is a PR still not merged.
for key, value in prompt.items():
if key in keys_to_find:
# print(f"debug find_keys_recursively: found key={key}")
if key == 'ckpt_name' and 'ckpt_path' in keys_to_find:
if key == 'ckpt_name':
value_path = Path(value)
found_values['ckpt_path'] = self.cleanup_fileName(str(value_path.parent))
if 'ckpt_path' in keys_to_find:
found_values['ckpt_path'] = self.cleanup_fileName(str(value_path.parent))
else:
found_values['ckpt_name'] = self.cleanup_fileName(str(value_path.name))
# print(f"debug find_keys_recursively: ckpt_name={value_path.name} ckpt_path={str(value_path.parent)}")
elif key == 'control_net_name' and 'control_net_path' in keys_to_find:
elif key == 'control_net_name':
value_path = Path(value)
found_values['control_net_path'] = self.cleanup_fileName(str(value_path.parent))
if 'control_net_path' in keys_to_find:
found_values['control_net_path'] = self.cleanup_fileName(str(value_path.parent))
else:
found_values['control_net_name'] = self.cleanup_fileName(str(value_path.name))
else:
found_values[key] = self.cleanup_fileName(value)
elif isinstance(value, dict):
@@ -310,7 +316,7 @@ ComfyUI can only load PNG and WebP at the moment, AVIF is a PR still not merged.
# Fractions and Superscripts '⅔','2²' False True True
# Roman Numerals 'ↁ' False False True
# --------------------------- --------- ----------- --------- -----------
def generate_custom_name(self, keys_to_extract, prefix, delimiter, prompt, timestamp=datetime.now(), named_keys=False):
def generate_custom_name(self, keys_to_extract, prefix, delimiter, prompt, resolution, timestamp=datetime.now(), named_keys=False):
if '%' in prefix:
custom_name = timestamp.strftime(prefix)
else:
@@ -387,6 +393,8 @@ ComfyUI can only load PNG and WebP at the moment, AVIF is a PR still not merged.
self.find_keys_recursively(prompt, ['ckpt_name', nodeKey], found_values)
elif nodeKey == 'control_net_path':
self.find_keys_recursively(prompt, ['control_net_name', nodeKey], found_values)
elif nodeKey == 'resolution':
value = resolution
else:
self.find_keys_recursively(prompt, [nodeKey], found_values)
# is key num.widget_name
@@ -723,15 +731,15 @@ ComfyUI can only load PNG and WebP at the moment, AVIF is a PR still not merged.
################################## UNCOMMENT HERE TO SEE THE ENTIRE PROMPT
# pprint.pprint(prompt)
##########################################################################
timestamp = datetime.now()
custom_foldername = self.generate_custom_name(foldername_keys_to_extract, foldername_prefix, delimiter, prompt, timestamp, named_keys)
custom_filename = self.generate_custom_name(filename_keys_to_extract, filename_prefix, delimiter, prompt, timestamp, named_keys)
# Get set resolution value
# Get set resolution value - that's a secret keyword
i = 255. * images[0].cpu().numpy()
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
resolution = f'{img.width}x{img.height}'
timestamp = datetime.now()
custom_foldername = self.generate_custom_name(foldername_keys_to_extract, foldername_prefix, delimiter, prompt, resolution, timestamp, named_keys)
custom_filename = self.generate_custom_name(filename_keys_to_extract, filename_prefix, delimiter, prompt, resolution, timestamp, named_keys)
# Create folders, count images, save images
try:
# folder_paths.get_save_image_path() is kind of magic, I don't like that. Outpout is wrong anyway, when custom_filename contains folders