Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d53328c8ac | ||
|
|
85967a9a4b | ||
|
|
bfabb38bea | ||
|
|
2a2e38397a |
@@ -1,4 +1,6 @@
|
||||
# 💾 Save Image Extended for ComfyUI
|
||||
Save as AVIF, WebP, JPEG, customize the folder, sub-folders, and filenames of your images!
|
||||
|
||||
Supports those extensions: **AVIF WebP JXL jpg jpeg png gif tiff bmp**
|
||||
|
||||
<p align="center">
|
||||
@@ -8,45 +10,15 @@ Supports those extensions: **AVIF WebP JXL jpg jpeg png gif tiff bmp**
|
||||
* 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 **AVIF** / **WebP** / **JPEG** / **JXL** ... And yes the prompt is included :)
|
||||
* ComfyUI can only load PNG and WebP atm
|
||||
* Promt saved in jpeg and AVIF, but ComfyUI can only load PNG and WebP atm
|
||||
|
||||
|
||||
<br>
|
||||
<p align="center">
|
||||
<img src="assets/save-image-extended-comfyui-named_nodes_widgets-example.png" />
|
||||
<br><br>
|
||||
Happy saving!
|
||||
</p>
|
||||
|
||||
*Reboot by AudioscavengeR since 2024-05-05, original idea from [@thedyze](https://github.com/thedyze/save-image-extended-comfyui)*
|
||||
|
||||
## Installation
|
||||
### Requirements:
|
||||
There is a requirements.txt that will take care of that, but just in case:
|
||||
|
||||
- python 10.6
|
||||
- piexif
|
||||
- pillow
|
||||
- pillow-avif-plugin
|
||||
|
||||
```
|
||||
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.
|
||||
|
||||
```
|
||||
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 under ComfyUI\custom_nodes\
|
||||
```
|
||||
git clone https://github.com/audioscavenger/save-image-extended-comfyui
|
||||
```
|
||||
|
||||
## Parameters / Usage
|
||||
|
||||
| Attribute | Description |
|
||||
@@ -93,6 +65,33 @@ Converts [unix datetime formats](https://www.man7.org/linux/man-pages/man1/date.
|
||||
<img src="assets/save-image-extended-comfyui-example-2.png" />
|
||||
</p>
|
||||
|
||||
## Installation
|
||||
### Requirements:
|
||||
There is a requirements.txt that will take care of that, but just in case:
|
||||
|
||||
- python 10.6
|
||||
- piexif
|
||||
- pillow
|
||||
- pillow-avif-plugin
|
||||
|
||||
```
|
||||
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.
|
||||
|
||||
```
|
||||
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 under ComfyUI\custom_nodes\
|
||||
```
|
||||
git clone https://github.com/audioscavenger/save-image-extended-comfyui
|
||||
```
|
||||
|
||||
## Miscelaneous
|
||||
#
|
||||
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.
|
||||
@@ -120,6 +119,9 @@ You can retrieve the prompt manually with [exiftool](https://exiftool.org/), her
|
||||
- `exiftool -Parameters -Prompt -Workflow image.png`
|
||||
- `exiftool -Parameters -UserComment -ImageDescription image.{jpg|jpeg|webp|avif|jxl}`
|
||||
|
||||
#
|
||||
ComfyUI cannot load lossless WebP atm. Feel free to try and fix `pnginfo.js`
|
||||
|
||||
#
|
||||
Incompatible with *extended-saveimage-comfyui* - This node can be safely discarded, as it only offers WebP output. My node already adds JPEG and WebP.
|
||||
|
||||
@@ -142,6 +144,7 @@ jobs.json sample: always generated and appended, not sure what it can be used fo
|
||||
|
||||
|
||||
## RoadMap
|
||||
*Reboot by AudioscavengeR since 2024-05-05, original idea from [@thedyze](https://github.com/thedyze/save-image-extended-comfyui)*
|
||||
|
||||
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.
|
||||
@@ -157,6 +160,10 @@ TODO:
|
||||
- [ ] 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.62 💾
|
||||
- prompt and workflow are saved in IFD 270 and 271 for better load compatibility
|
||||
- disabled jobs.json by default, this thingy seems useless to me
|
||||
|
||||
### release 2.61 💾
|
||||
- added quality input
|
||||
|
||||
@@ -220,3 +227,5 @@ TODO:
|
||||
### release 2.0
|
||||
- [x] Reboot on 2024-05-05
|
||||
|
||||
## :ribbon: Licence
|
||||
[GPL 3.0](https://choosealicense.com/licenses/gpl-3.0/)
|
||||
|
||||
+11
-5
@@ -44,7 +44,7 @@ original_locale = locale.setlocale(locale.LC_TIME, '')
|
||||
|
||||
# class SaveImageExtended -------------------------------------------------------------------------------
|
||||
class SaveImageExtended:
|
||||
version = 2.61
|
||||
version = 2.62
|
||||
type = 'output'
|
||||
|
||||
png_compress_level = 9
|
||||
@@ -62,7 +62,7 @@ class SaveImageExtended:
|
||||
foldername_prefix = ''
|
||||
foldername_keys = 'ckpt_name'
|
||||
delimiter = '-'
|
||||
save_job_data = 'basic, models, sampler, prompt'
|
||||
save_job_data = 'disabled'
|
||||
job_data_per_image = False
|
||||
job_custom_text = ''
|
||||
save_metadata = True
|
||||
@@ -464,7 +464,8 @@ class SaveImageExtended:
|
||||
## For Comfy to load an image, it need a PNG tag at the root: Prompt={prompt}
|
||||
## For AVIF WebP Jpeg, it's only Exif that's available... and UserComment is the best choice.
|
||||
|
||||
## This method gives wrong results, as [ExifTool] will issue Warning: Invalid EXIF text encoding for UserComment
|
||||
## This method gives good results, as long as you save the prompt/workflow in 2 separate Exif tags
|
||||
## Otherwise, [ExifTool] will issue Warning: Invalid EXIF text encoding for UserComment
|
||||
# entryOffset 10
|
||||
# tag 37510
|
||||
# type 2
|
||||
@@ -481,7 +482,10 @@ class SaveImageExtended:
|
||||
# 0x010e: ImageDescription
|
||||
# 0x010f: Make
|
||||
# 0x9286: UserComment
|
||||
exif[0x9286] = "Prompt: " + json.dumps(metadata['prompt']) # UserComment
|
||||
# both prompt and workflow must be in IFD close together of that can cause problems for the parseIFD function on import
|
||||
# https://exiftool.org/TagNames/EXIF.html
|
||||
# exif[0x9286] = "Prompt: " + json.dumps(metadata['prompt']) # UserComment
|
||||
exif[0x010f] = "Prompt: " + json.dumps(metadata['prompt']) # Make
|
||||
exif[0x010e] = "Workflow: " + json.dumps(metadata['workflow']) # ImageDescription
|
||||
|
||||
# exif[ExifTags.Base.UserComment] = piexif.helper.UserComment.dump(json.dumps(metadata), encoding="unicode") # type 4
|
||||
@@ -523,7 +527,9 @@ class SaveImageExtended:
|
||||
output_ext = os.path.splitext(os.path.basename(image_path))[1]
|
||||
metadata = None
|
||||
kwargs = dict()
|
||||
|
||||
|
||||
# TODO: see if convert_hdr_to_8bit=False make a change
|
||||
|
||||
# match is python 3.10+
|
||||
if output_ext in ['.avif']:
|
||||
if save_metadata: kwargs["exif"] = self.get_metadata_exif(img, prompt, extra_pnginfo)
|
||||
|
||||
Reference in New Issue
Block a user