Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab2410ba95 | ||
|
|
6369fb315f | ||
|
|
fc67d2b6b0 | ||
|
|
906d2b9669 | ||
|
|
53b9270e12 | ||
|
|
61f89b803f | ||
|
|
a2f4b00fa1 |
@@ -1,5 +1,5 @@
|
||||
# Save Image Extended for ComfyUI
|
||||
**AVIF** support!
|
||||
# 💾 Save Image Extended for ComfyUI
|
||||
**AVIF** / **WebP** / **JXL** support!
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/save-image-extended-comfyui-example.png" />
|
||||
@@ -7,8 +7,9 @@
|
||||
|
||||
* Customize the folder, sub-folders, and filenames of your images!
|
||||
* Save data about the generated job (sampler, prompts, models) as entries in a `json` (text) file, in each folder.
|
||||
* Use the values of ANY node's widget, by simply adding its badge number in the form _id.widget_name_:
|
||||
* Oh btw... also saves your output as **WebP** or **JPEG**... And yes the prompt is included :) ComfyUI can load it but a PR approval is needed.
|
||||
* Use the values of ANY node's widget, by simply adding its badge number in the form _id.widget_name_
|
||||
* Oh btw... also saves your output as **AVIF** / **WebP** / **JPEG** / **JXL** ... And yes the prompt is included :)
|
||||
* ComfyUI can only load PNG and WebP atm
|
||||
|
||||
|
||||
<br>
|
||||
@@ -33,15 +34,21 @@ There is a requirements.txt that will take care of that, but just in case:
|
||||
pip install piexif pillow pillow-avif-plugin
|
||||
```
|
||||
|
||||
For Jpeg XL / jxl it's more complicated. You need to install and compile the wheel jxlpy, and therefore, need a valid and functional MSVC installation.
|
||||
|
||||
### Installation
|
||||
```
|
||||
pip install jxlpy
|
||||
```
|
||||
|
||||
### Manual Download
|
||||
1. Open a terminal inside the 'custom_nodes' folder located in your ComfyUI installation dir
|
||||
2. Use the `git clone` command to clone the [save-image-extended-comfyui](https://github.com/audioscavenger/save-image-extended-comfyui) repo.
|
||||
2. Use the `git clone` command to clone the [save-image-extended-comfyui](https://github.com/audioscavenger/save-image-extended-comfyui) repo under ComfyUI\custom_nodes\
|
||||
```
|
||||
git clone https://github.com/audioscavenger/save-image-extended-comfyui
|
||||
```
|
||||
|
||||
## Parameters / Usage
|
||||
|
||||
| Attribute | Description |
|
||||
| --- | --- |
|
||||
| `filename_prefix` | String prefix added to files. |
|
||||
@@ -59,7 +66,9 @@ git clone https://github.com/audioscavenger/save-image-extended-comfyui
|
||||
| `image_preview` | Turns the image preview on and off. |
|
||||
| `output_ext` | File extension: PNG by default, or WEBP (coming soon). |
|
||||
|
||||
Unknown key names in `filename_keys` and `foldername_keys` are treated as custom strings.
|
||||
Unknown key names in `filename_keys` and `foldername_keys` are treated as custom strings: if you enter `wrongNumber.attribute`, you will get `attribute` in your filename.
|
||||
|
||||
Datetime UNIX format is now included! `%Y-%m-%d` or `%F` etc
|
||||
|
||||
## Node inputs
|
||||
|
||||
@@ -69,9 +78,21 @@ Optional:
|
||||
- `positive_text_opt` - Optional string input for when using custom nodes for positive prompt text.
|
||||
- `negative_text_opt` - Optional string input for when using custom nodes for negative prompt text.
|
||||
|
||||
## Automatic folder names and date/time in names
|
||||
## Automatic date/time conversion in file/folder names
|
||||
|
||||
Converts [unix datetime formats](https://www.man7.org/linux/man-pages/man1/date.1.html):
|
||||
|
||||
| Unix datetime | Example | Comment |
|
||||
| --- | --- | --- |
|
||||
| %F or %Y-%m-%d | 2024-05-22 | |
|
||||
| %D | 05/22/24 | This effectively creates subfolders |
|
||||
| %F %H-%M-%S | 2024-05-22 09-13-58 | |
|
||||
| %Y/%V | 2024/21 | year subfolder / ISO week number subfolder |
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/save-image-extended-comfyui-example-2.png" />
|
||||
</p>
|
||||
|
||||
Convert the 'prefix' parameters to inputs (right click in the node and select e.g 'convert foldername_prefix to input'. Then attach the 'Get Date Time String' custom node from JPS to these inputs. This way a new folder name can be automatically generated each time generate is pressed.
|
||||
#
|
||||
Disclaimer: Does not check for illegal characters entered in file or folder names. May not be compatible with every other custom node, depending on changes in the `prompt` object.
|
||||
Tested and working with default samplers, Efficiency nodes, UltimateSDUpscale, ComfyRoll, composer, NegiTools, and 45 other nodes.
|
||||
@@ -79,13 +100,17 @@ Tested and working with default samplers, Efficiency nodes, UltimateSDUpscale, C
|
||||
#
|
||||
Quality and compression settings:
|
||||
|
||||
* AVIF quality is fixed at 50.
|
||||
* AVIF quality is fixed at 60.
|
||||
* WebP quality is fixed at 75.
|
||||
* JPEG quality is fixed at 91.
|
||||
* JXL quality is fixed at 91.
|
||||
* PNG is maxed compressed (9)
|
||||
|
||||
Start a discussion or a poll if you want to change output quality, and add another attribute in the node. There's so many already, some complain about the node being too tall.
|
||||
|
||||
|
||||
#
|
||||
About extensions WebP AVIF JPEG: ComfyUI cannot load it atm... Feel free to ask ComfyUI team to add support for AVIF/WebP/jpeg!
|
||||
About extensions WebP AVIF JPEG JXL: ComfyUI can only load PNG and WebP atm... Feel free to ask ComfyUI team to add support for AVIF/jpeg/JXL!
|
||||
|
||||
The prompt is included under the **EXIF** tag `UserComment` (IFD0 / 0x9286) as defined [here](https://exiftool.org/TagNames/EXIF.html).
|
||||
It is saved in this form: `UserComment = {"prompt": {"1": {"inputs": {...}}}}`.
|
||||
@@ -99,15 +124,15 @@ You can retrieve the prompt manually with [exiftool](https://exiftool.org/), her
|
||||
Incompatible with *extended-saveimage-comfyui* - This node can be safely discarded, as it only offers WebP output. My node already adds JPEG and WebP.
|
||||
|
||||
#
|
||||
You asked for it... Now you can select which node to get the widget values from! Formerly, this custom node would simply return the last value found: useles if you have many Ksamplers...
|
||||
Make sure you enable the badge IDs to benefit from this:
|
||||
You asked for it... Now you can select which node to get the widget values from! Formerly, this custom node would simply return the last value found: useless if you have multiple same nodes...
|
||||
To see node numbers in the UI, **enable the badge IDs**:
|
||||
<br>
|
||||
<p align="center">
|
||||
<img src="assets/ComfyUI-enable-badge-ids.png" />
|
||||
</p>
|
||||
|
||||
#
|
||||
jobs.json sample:
|
||||
jobs.json sample: always generated and appended, not sure what it can be used for.
|
||||
<br>
|
||||
<p align="center">
|
||||
<img src="assets/save-image-extended-comfyui-jobs-example.png" />
|
||||
@@ -118,12 +143,12 @@ jobs.json sample:
|
||||
|
||||
## RoadMap
|
||||
|
||||
I won't promise anything, just like @thedyze did not promise anything when they released this custom node.
|
||||
Then disappeared for good 3 months later. That's fine, I do that too.
|
||||
|
||||
However, I do provide a way to contact me, and will accept PR and collabs.
|
||||
I won't promise you the moon, but since I use this node myself, I will maintain it as much as I can. I do provide a way to contact me, and will accept PR and collabs.
|
||||
Once I feel like I don't have time to work on it, I will gladly transfer ownership or let collabs maintain it.
|
||||
|
||||
TODO:
|
||||
|
||||
- [ ] ComfyRoll CR XY Save Grid Image: it offers jpeg webp tif - check how it embeds prompt and see if that works better with Comfy!
|
||||
- [ ] offer quality setting in the node?
|
||||
- [ ] remove save_job_to_json? thisis pretty much useless actually, since it only saves the last value found for each node.
|
||||
- [ ] remove job_custom_text? what is this for?
|
||||
@@ -132,13 +157,28 @@ Once I feel like I don't have time to work on it, I will gladly transfer ownersh
|
||||
- [ ] offer to place the counter anywhere, as a key in filename_keys
|
||||
- [ ] files can get out of order if prefixes change... that is expected, but is this what we want? another reason to have the counter place anywhere we want
|
||||
|
||||
### release 2.51 💾
|
||||
- added unix datetime formats
|
||||
|
||||
### release 2.50 💾
|
||||
- added JXL support
|
||||
- added 'BOOLEAN' support
|
||||
|
||||
### release 2.46 💾
|
||||
- bug discovered with *rgthree's Ksampler Config*: using `steps_total` as an input to a Ksampler, will issue the index of the output, instead of the steps value ("\[nodeNum, 0]" instead of steps value). FIX: use `steps_total` instead of `steps`!
|
||||
- uncommented `__all__` in init.py
|
||||
- potential bugfix in splitKey, `len(splitKey) = 2` to identify actual "node.widget" format
|
||||
|
||||
### release 2.45 💾
|
||||
- added 💾 in the name
|
||||
|
||||
### release 2.44
|
||||
- so many bugfixes
|
||||
- complete rework of generate_custom_name to handle ALL the possible scenarios
|
||||
- [x] bugfix: when using /name in foldername_keys, Comfy thinks you want to save outside the output folder
|
||||
- [x] bugfix: when using `/name` in foldername_keys, Comfy thinks you want to save outside the output folder
|
||||
|
||||
### release 2.43
|
||||
- [x] support for AVIF
|
||||
- [x] support for **AVIF**
|
||||
- [x] added requirements.txt
|
||||
|
||||
### release 2.42
|
||||
@@ -149,8 +189,8 @@ Once I feel like I don't have time to work on it, I will gladly transfer ownersh
|
||||
- [x] WebP is indeed loaded properly like a PNG, if you apply the patch above to `pnginfo.js and `app.js`
|
||||
|
||||
### release 2.4
|
||||
- [x] integrate webp
|
||||
- [x] integrate jpg
|
||||
- [x] integrate **webp**
|
||||
- [x] integrate **jpeg**
|
||||
|
||||
### release 2.3
|
||||
- [x] for each keys, we return only the last value found in the prompt. Not the last Ksampler. Impossible to know which one is the last. Therefore, simply use this syntax: number.widget_name
|
||||
|
||||
+1
-1
@@ -13,4 +13,4 @@
|
||||
|
||||
from .save_image_extended import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
|
||||
|
||||
# __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 61 KiB |
+77
-33
@@ -11,10 +11,28 @@ import pprint
|
||||
import piexif
|
||||
import piexif.helper
|
||||
|
||||
avif_supported = False
|
||||
jxl_supported = False
|
||||
|
||||
# Avif is included in requirements.txt
|
||||
try:
|
||||
import pillow_avif
|
||||
except ModuleNotFoundError:
|
||||
except:
|
||||
print(f"\033[92m[save_image_extended]\033[0m AVIF is not supported. To add it: pip install pillow pillow-avif-plugin\033[0m")
|
||||
pass
|
||||
else:
|
||||
print(f"\033[92m[save_image_extended] AVIF is supported! Woohoo!\033[0m")
|
||||
avif_supported = True
|
||||
|
||||
# Jxl requires jxlpy wheel to be compiled, and a valid MSVC environment, which is complex task
|
||||
try:
|
||||
from jxlpy import JXLImagePlugin
|
||||
except:
|
||||
print(f"\033[92m[save_image_extended]\033[0m JXL is not supported. To add it: pip install jxlpy\033[0m")
|
||||
print(f"\033[92m[save_image_extended]\033[0m You will need a valid MSVC env to build the wheel\033[0m")
|
||||
pass
|
||||
else:
|
||||
jxl_supported = True
|
||||
|
||||
# PIL must be loaded after pillow_avif
|
||||
from PIL import Image, ExifTags
|
||||
@@ -26,13 +44,15 @@ original_locale = locale.setlocale(locale.LC_TIME, '')
|
||||
|
||||
# class SaveImageExtended -------------------------------------------------------------------------------
|
||||
class SaveImageExtended:
|
||||
version = 2.44
|
||||
version = 2.51
|
||||
type = 'output'
|
||||
|
||||
png_compress_level = 9
|
||||
lossless = False
|
||||
avif_quality = 60
|
||||
webp_quality = 75
|
||||
jpeg_quality = 91
|
||||
jxl_quality = 91
|
||||
|
||||
filename_prefix = 'ComfyUI'
|
||||
filename_keys = 'sampler_name, scheduler, cfg, steps'
|
||||
@@ -49,15 +69,15 @@ class SaveImageExtended:
|
||||
one_counter_per_folder = True
|
||||
image_preview = True
|
||||
extToRemove = ['.safetensors', '.ckpt', '.pt', '.bin', '.pth']
|
||||
output_ext = '.webp'
|
||||
output_exts = ['.webp', '.png', '.jpg']
|
||||
|
||||
print(f"\033[92m[save_image_extended]\033[0m version: {version}\033[0m")
|
||||
if pillow_avif not in sys.modules:
|
||||
output_ext = '.avif'
|
||||
output_exts = ['.avif', '.png', '.webp', '.jpg']
|
||||
print(f"\033[92m[save_image_extended] AVIF is supported! Woohoo!\033[0m\n")
|
||||
else:
|
||||
output_ext = '.png'
|
||||
output_exts = ['.png', '.webp', '.jpg']
|
||||
if jxl_supported:
|
||||
output_exts.insert(0, '.jxl')
|
||||
# if pillow_avif not in sys.modules:
|
||||
if avif_supported:
|
||||
output_exts.insert(0, '.avif')
|
||||
|
||||
def __init__(self):
|
||||
self.output_dir = folder_paths.get_output_directory()
|
||||
@@ -95,9 +115,9 @@ class SaveImageExtended:
|
||||
'basic, sampler, prompt',
|
||||
'basic, models, sampler, prompt'
|
||||
], {'default': self.save_job_data}),
|
||||
'job_data_per_image': ([False, True], {'default': self.job_data_per_image}),
|
||||
'job_data_per_image': ('BOOLEAN', {"default": self.job_data_per_image}),
|
||||
'job_custom_text': ('STRING', {'default': self.job_custom_text, 'multiline': False}),
|
||||
'save_metadata': ([True, False], {'default': self.save_metadata}),
|
||||
'save_metadata': ('BOOLEAN', {'default': self.save_metadata}),
|
||||
'counter_digits': ('INT', {
|
||||
"default": self.counter_digits,
|
||||
"min": 1,
|
||||
@@ -106,8 +126,8 @@ class SaveImageExtended:
|
||||
"display": "silder"
|
||||
}),
|
||||
'counter_position': (self.counter_positions, {'default': self.counter_position}),
|
||||
'one_counter_per_folder': ([True, False], {'default': self.one_counter_per_folder}),
|
||||
'image_preview': ([True, False], {'default': self.image_preview}),
|
||||
'one_counter_per_folder': ('BOOLEAN', {'default': self.one_counter_per_folder}),
|
||||
'image_preview': ('BOOLEAN', {'default': self.image_preview}),
|
||||
'output_ext': (self.output_exts, {'default': self.output_ext}),
|
||||
},
|
||||
'optional': {
|
||||
@@ -136,7 +156,7 @@ class SaveImageExtended:
|
||||
def get_latest_counter(self, one_counter_per_folder, folder_path, filename_prefix, counter_digits=counter_digits, counter_position=counter_position, output_ext=output_ext):
|
||||
counter = 1
|
||||
if not os.path.exists(folder_path):
|
||||
print(f"SaveImageExtended error: Folder {folder_path} does not exist, starting counter at 1.")
|
||||
print(f"SaveImageExtended {version} error: Folder {folder_path} does not exist, starting counter at 1.")
|
||||
return counter
|
||||
|
||||
try:
|
||||
@@ -154,7 +174,7 @@ class SaveImageExtended:
|
||||
counter = max(counters) + 1
|
||||
|
||||
except Exception as e:
|
||||
print(f"SaveImageExtended error: An error occurred while finding the latest counter: {e}")
|
||||
print(f"SaveImageExtended {version} error: An error occurred while finding the latest counter: {e}")
|
||||
|
||||
return counter
|
||||
|
||||
@@ -212,14 +232,17 @@ class SaveImageExtended:
|
||||
# Fractions and Superscripts '⅔','2²' False True True
|
||||
# Roman Numerals 'ↁ' False False True
|
||||
# --------------------------- --------- ----------- --------- -----------
|
||||
def generate_custom_name(self, keys_to_extract, prefix, delimiter, prompt):
|
||||
def generate_custom_name(self, keys_to_extract, prefix, delimiter, prompt, timestamp=datetime.now()):
|
||||
if '%' in prefix:
|
||||
custom_name = timestamp.strftime(prefix)
|
||||
else:
|
||||
custom_name = prefix
|
||||
|
||||
if prompt is not None and keys_to_extract != ['']:
|
||||
found_values = {}
|
||||
# print(f"debug generate_custom_name: --prefix: {prefix}")
|
||||
# print(f"debug generate_custom_name: --keys_to_extract: {keys_to_extract}")
|
||||
# print(f"debug generate_custom_name: --prompt:")
|
||||
# pprint.pprint(prompt)
|
||||
|
||||
# now separating numbered keys from non-numbered keys:
|
||||
# 37.ckpt_name = i want the ckpt_name from node #37
|
||||
@@ -229,17 +252,21 @@ class SaveImageExtended:
|
||||
# 'inputs': {'cfg': 1.6,
|
||||
# 'denoise': 1.0, ...
|
||||
for key in keys_to_extract:
|
||||
if not key: continue
|
||||
|
||||
value = None
|
||||
node, nodeKey = None, None
|
||||
|
||||
# check if this is a subfolder: starts with ./ or /, can also end with /
|
||||
if '/' in key:
|
||||
# key is a fsubfolder
|
||||
# we also exclude datetime formats like "%A %d. %B %Y"
|
||||
if '/' in key and not '%' in key:
|
||||
# key is a subfolder: ./subfolder or ../subfolder or /subfolder
|
||||
value = key
|
||||
else:
|
||||
splitKey = key.split('.')
|
||||
# we also exclude cases like "string." or ".string" or "string.string"
|
||||
if len(splitKey) > 1:
|
||||
# we also exclude cases like "..string" or "sting.string.x" etc
|
||||
# we also exclude datetime formats like "%A %d. %B %Y"
|
||||
if len(splitKey) == 2 and not '%' in key:
|
||||
# key has the form string.string
|
||||
if '' not in splitKey:
|
||||
# key has the form string.string
|
||||
@@ -258,10 +285,14 @@ class SaveImageExtended:
|
||||
# key is in the form string.string = fixed string
|
||||
value = self.cleanup_fileName(key)
|
||||
else:
|
||||
# key is in the form ".string" or "string." or "." - we won't clean that up and keep as is
|
||||
# key is in the form ".string" or "string." or "." - we won't clean that up and keep as is, maybe it's a separator
|
||||
value = key
|
||||
else:
|
||||
# nodeKey is not a folder, has no dot, could be a valid key to find, could be a fixed string - keep as is
|
||||
# could be a datetime format
|
||||
if '%' in key:
|
||||
value = timestamp.strftime(key)
|
||||
# nodeKey is not a datetime, folder, has no dot, or multiple dots, could be a valid key to find, could be a fixed string - keep as is
|
||||
else:
|
||||
nodeKey = key
|
||||
self.find_keys_recursively(prompt, [nodeKey], found_values)
|
||||
# is key num.widget_name
|
||||
@@ -307,7 +338,7 @@ class SaveImageExtended:
|
||||
return custom_name.strip(delimiter).strip('.').strip('/').strip(delimiter)
|
||||
|
||||
|
||||
def save_job_to_json(self, save_job_data, prompt, filename_prefix, positive_text_opt, negative_text_opt, job_custom_text, resolution, output_path, filename):
|
||||
def save_job_to_json(self, save_job_data, prompt, filename_prefix, positive_text_opt, negative_text_opt, job_custom_text, resolution, output_path, filename, timestamp=datetime.now()):
|
||||
prompt_keys_to_save = {}
|
||||
if 'basic' in save_job_data:
|
||||
if len(filename_prefix) > 0:
|
||||
@@ -389,10 +420,10 @@ class SaveImageExtended:
|
||||
with open(json_file_path, 'r') as f:
|
||||
existing_data = json.load(f)
|
||||
except json.JSONDecodeError:
|
||||
print(f"SaveImageExtended error: The file {json_file_path} is empty or malformed. Initializing with empty data.")
|
||||
print(f"SaveImageExtended {version} error: The file {json_file_path} is empty or malformed. Initializing with empty data.")
|
||||
existing_data = {}
|
||||
|
||||
timestamp = datetime.now().strftime('%c')
|
||||
timestamp = timestamp.strftime('%c')
|
||||
new_entry = {}
|
||||
new_entry[timestamp] = prompt_keys_to_save
|
||||
existing_data.update(new_entry)
|
||||
@@ -434,6 +465,9 @@ class SaveImageExtended:
|
||||
dump = json.dumps(metadata)
|
||||
# print(f"dump={dump}") {"prompt": { .. }, "workflow": { .. }}
|
||||
exif[ExifTags.Base.UserComment] = json.dumps(metadata)
|
||||
# This should work the same:
|
||||
# exif[0x9286] = json.dumps(metadata)
|
||||
|
||||
# exif[ExifTags.Base.UserComment] = piexif.helper.UserComment.dump(json.dumps(metadata), encoding="unicode") # type 4
|
||||
# exif[ExifTags.Base.UserComment] = piexif.helper.UserComment.dump(json.dumps(metadata), encoding="jis") # type 1
|
||||
# exif[ExifTags.Base.UserComment] = piexif.helper.UserComment.dump(json.dumps(metadata), encoding="ascii") # type 1
|
||||
@@ -478,16 +512,22 @@ class SaveImageExtended:
|
||||
match output_ext:
|
||||
case '.avif':
|
||||
if save_metadata: kwargs["exif"] = self.get_metadata_exif(img, prompt, extra_pnginfo)
|
||||
kwargs["lossless"] = self.lossless
|
||||
kwargs["quality"] = self.avif_quality
|
||||
case '.webp':
|
||||
if save_metadata: kwargs["exif"] = self.get_metadata_exif(img, prompt, extra_pnginfo)
|
||||
kwargs["lossless"] = False
|
||||
kwargs["lossless"] = self.lossless
|
||||
kwargs["quality"] = self.webp_quality
|
||||
if self.webp_quality == 100: kwargs["lossless"] = True
|
||||
case '.jpg':
|
||||
if save_metadata: kwargs["exif"] = self.get_metadata_exif(img, prompt, extra_pnginfo)
|
||||
kwargs["quality"] = self.jpeg_quality
|
||||
case '.jxl':
|
||||
kwargs["lossless"] = self.lossless
|
||||
if save_metadata: kwargs["exif"] = self.get_metadata_exif(img, prompt, extra_pnginfo)
|
||||
kwargs["quality"] = self.jxl_quality
|
||||
case _:
|
||||
# png: no quality
|
||||
if save_metadata: kwargs["pnginfo"] = self.get_metadata_png(img, prompt, extra_pnginfo)
|
||||
kwargs["compress_level"] = self.png_compress_level
|
||||
# png
|
||||
@@ -537,8 +577,12 @@ class SaveImageExtended:
|
||||
filename_keys_to_extract = [item.strip() for item in filename_keys.split(',')]
|
||||
foldername_keys_to_extract = [item.strip() for item in foldername_keys.split(',')]
|
||||
|
||||
custom_filename = self.generate_custom_name(filename_keys_to_extract, filename_prefix, delimiter, prompt)
|
||||
custom_foldername = self.generate_custom_name(foldername_keys_to_extract, foldername_prefix, delimiter, prompt)
|
||||
################################## UNCOMMENT HERE TO SEE THE ENTIRE PROMPT
|
||||
# pprint.pprint(prompt)
|
||||
##########################################################################
|
||||
timestamp = datetime.now()
|
||||
custom_filename = self.generate_custom_name(filename_keys_to_extract, filename_prefix, delimiter, prompt, timestamp)
|
||||
custom_foldername = self.generate_custom_name(foldername_keys_to_extract, foldername_prefix, delimiter, prompt, timestamp)
|
||||
|
||||
# Get set resolution value
|
||||
i = 255. * images[0].cpu().numpy()
|
||||
@@ -570,17 +614,17 @@ class SaveImageExtended:
|
||||
self.save_image(image_path, img, prompt, save_metadata, extra_pnginfo)
|
||||
|
||||
if save_job_data != 'disabled' and job_data_per_image:
|
||||
self.save_job_to_json(save_job_data, prompt, filename_prefix, positive_text_opt, negative_text_opt, job_custom_text, resolution, output_path, f'{file.removesuffix(output_ext)}.json')
|
||||
self.save_job_to_json(save_job_data, prompt, filename_prefix, positive_text_opt, negative_text_opt, job_custom_text, resolution, output_path, f'{file.removesuffix(output_ext)}.json', timestamp)
|
||||
|
||||
subfolder = self.get_subfolder_path(image_path, self.output_dir)
|
||||
results.append({ 'filename': file, 'subfolder': subfolder, 'type': self.type})
|
||||
counter += 1
|
||||
|
||||
if save_job_data != 'disabled' and not job_data_per_image:
|
||||
self.save_job_to_json(save_job_data, prompt, filename_prefix, positive_text_opt, negative_text_opt, job_custom_text, resolution, output_path, 'jobs.json')
|
||||
self.save_job_to_json(save_job_data, prompt, filename_prefix, positive_text_opt, negative_text_opt, job_custom_text, resolution, output_path, 'jobs.json', timestamp)
|
||||
|
||||
except OSError as e:
|
||||
print(f"SaveImageExtended error: An error occurred while creating the subfolder or saving the image: {e}")
|
||||
print(f"SaveImageExtended {version} error: An error occurred while creating the subfolder or saving the image: {e}")
|
||||
else:
|
||||
if not image_preview:
|
||||
results = list()
|
||||
@@ -593,7 +637,7 @@ NODE_CLASS_MAPPINGS = {
|
||||
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
'SaveImageExtended': 'Save Image Extended',
|
||||
'SaveImageExtended': '💾 Save Image Extended',
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user