feat(nodes): add Save Image (Gallery + File Export) node#9077
Open
Pfannkuchensack wants to merge 5 commits intomainfrom
Open
feat(nodes): add Save Image (Gallery + File Export) node#9077Pfannkuchensack wants to merge 5 commits intomainfrom
Pfannkuchensack wants to merge 5 commits intomainfrom
Conversation
Saves an image to the gallery and additionally exports a copy to the
filesystem with a custom filename using prefix and suffix around the
gallery UUID.
- Filename pattern: {prefix}{uuid}{suffix}.{png|jpg|webp}
- UUID matches the gallery entry so exported files can be matched back
- Quality input (1-100) for JPG/WEBP, ignored for PNG
- Board and Metadata inputs behave like the standard Save Image node
- Output directory restricted to subfolders of the InvokeAI outputs
folder; absolute paths and path traversal are rejected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new invocation Save Image (Gallery + File Export) (
save_image_to_file) that saves an image to the gallery like the standardSave Imagenode and additionally writes a copy to the filesystem with a customizable filename built from a prefix and suffix around the gallery UUID.{prefix}{uuid}{suffix}.{png|jpg|webp}Save Imagenode (viaWithBoard/WithMetadatamixins).D:/...,/etc/...) and path traversal (..) are rejected with a clearValueError.Example
prefixhero_suffix_finalfile_formatpngoutput_directoryexports/2026Result on disk:
<outputs>/exports/2026/hero_<uuid>_final.pngGallery entry:
<uuid>.png(unchanged)Related Issues / Discussions
Closes #8372
QA Instructions
image).imageinput.output_directory,prefix,suffixempty,file_format = png.<uuid>.pngexists in the configured outputs folder.prefix = "test_",suffix = "_v1", run again.<outputs>/test_<uuid>_v1.pngexists.output_directory = "my-exports/sub", run again.<outputs>/my-exports/sub/<uuid>.pngexists and that the directory was created automatically.file_format = jpg,quality = 60, use an image with alpha.quality = 95.file_format = webp.output_directory = "D:/some/path"(or/tmp/fooon Linux).output_directory = "../outside"or"subdir/../../outside".Save Imagebehavior).Automated tests
20 unit tests are included in
tests/app/invocations/test_save_image_to_file.pycovering:D:/,C:/,/etc,/tmp)..,subdir/../../outside)qualitybounds (1–100) enforced by pydanticimage_dtoRun with:
Merge Plan
Standard merge.
Checklist
What's Newcopy (if doing a release after this PR) — to be decided at release time