Save Image (JPG):
SaveImageJPG saves images from a ComfyUI workflow as JPEG files in the configured output directory. It is an output node, so its purpose is to produce files rather than pass images to another node. It saves each image in a batch separately, numbers the files to help keep them distinct, and reports the saved files to the interface. JPEG is useful when you want widely compatible images with an adjustable balance between visual quality and file size. Because JPEG does not support transparency, the node converts images with an alpha channel to RGB before saving. When metadata is enabled in ComfyUI, the node can also write available workflow-related information into JPEG EXIF metadata.
Save Image (JPG) Input Parameters:
images
The images to save, supplied through an IMAGE connection. The node processes every image in the batch and creates a separate JPEG for each one. This input must contain at least one image: the node reads the first image’s dimensions while preparing the save location. No default, minimum, or maximum batch size is specified in the provided node interface.
filename_prefix
A STRING used as the starting text for saved filenames. Its default is ComfyUI; no length limit or set of options is specified in the node interface. The node passes this prefix to ComfyUI’s image-path helper, which determines the output location and base filename, then adds a five-digit counter and the .jpg extension. If the resulting filename contains %batch_num%, the node replaces that text with the image’s zero-based position in the batch.
quality
An INT setting that controls JPEG encoding quality. Its default is 95, its minimum is 1, its maximum is 100, and it changes in steps of 1. Lower values generally produce smaller files with more visible compression; higher values generally retain more detail but produce larger files. This setting is passed directly to the JPEG saver and does not change the images earlier in your workflow.
Save Image (JPG) Output Parameters:
SaveImageJPG has no output sockets. After saving, it returns information about the saved files to the ComfyUI interface, including each file’s name, subfolder, and output type. You can inspect the result in the interface, but you cannot connect this node’s result to another node as an image output.
Save Image (JPG) Usage Tips:
- Use a descriptive
filename_prefixto distinguish exports from different projects or workflow runs. Include%batch_num%when you want the image’s position within a batch reflected in the filename. - Start with the default
qualityof95when image detail matters. Try a lower value when smaller files are more important, and inspect the saved JPEG for unwanted compression artifacts. - If your artwork needs transparency, keep a transparency-supporting copy elsewhere in your workflow. This node converts RGBA images to RGB for JPEG saving, so the saved file will not retain an alpha channel.
- Connect a non-empty image batch before running the node. It saves each image separately and advances the filename counter for each file.
Save Image (JPG) Common Errors and Solutions:
IndexError: index 0 is out of bounds or another error while accessing images[0]
- Explanation: The node uses the first image to determine dimensions before saving. An empty image batch has no first image; the exact error wording depends on how the batch is represented.
- Solution: Check that an upstream node produces at least one image and that its
IMAGEoutput is connected toimages.
AttributeError involving shape, cpu, or numpy
- Explanation: The node expects image data in the format supplied by a compatible ComfyUI
IMAGEconnection. Data in another form may not have the properties or operations the save routine uses. - Solution: Connect a compatible
IMAGEoutput directly, or use an appropriate conversion node before SaveImageJPG.
TypeError: Cannot handle this data type or a JPEG image-mode error
- Explanation: The image could not be converted into a form Pillow can save as JPEG. The node explicitly converts RGBA images to RGB, but the supplied image may have another unsupported shape or mode.
- Solution: Check the upstream image-processing nodes and supply a standard image compatible with the
IMAGEinput.
PermissionError or OSError while saving the file
- Explanation: The JPEG could not be written to the output location. Possible causes include insufficient write permissions, an unavailable output location, or lack of storage space; the precise message depends on the operating system.
- Solution: Check that ComfyUI’s configured output directory is accessible and writable, that storage is available, and that the resulting filename is valid for your system.
quality is outside the allowed range
- Explanation: The node interface permits whole-number quality values from
1through100. A value outside that range may be rejected during input validation. - Solution: Set
qualityto a whole number between1and100.
