Image Saver:
The Image_saver node is designed to facilitate the efficient saving of images generated or processed within a workflow. Its primary purpose is to convert image data into standard image file formats such as PNG, JPEG, and WEBP, while also embedding relevant metadata for future reference. This node is particularly beneficial for AI artists who need to manage and organize large batches of images, as it automates the process of naming, formatting, and storing images. By handling different image formats and embedding metadata like prompts and creation timestamps, the Image_saver ensures that your creative work is preserved with all necessary contextual information, making it easier to revisit and understand the creative process behind each image.
Image Saver Input Parameters:
images
This parameter accepts the image data that you wish to save. It can handle both single images and batches of images, automatically processing them to ensure they are in the correct format for saving. The images can be in the form of NumPy arrays or PyTorch tensors, and the node will convert them to the appropriate format as needed.
prompt_list
A list of prompts associated with the images. This parameter allows you to embed descriptive text or prompts into the image metadata, which can be useful for tracking the creative inspiration or instructions that led to the image's creation.
include_timestamp
A boolean parameter that determines whether to include a timestamp in the saved image's filename. This helps in organizing images chronologically and avoiding filename conflicts. The default value is True.
timestamp_format
Specifies the format of the timestamp to be included in the filename. This parameter follows the standard Python datetime formatting conventions, allowing you to customize how the date and time appear in the filename.
image_format
Defines the format in which the image will be saved. Options include "PNG", "JPEG", and "WEBP". Each format has its own advantages, such as PNG's lossless compression or JPEG's smaller file size, allowing you to choose based on your needs.
jpeg_quality
An integer parameter that sets the quality of JPEG images, ranging from 1 (lowest quality) to 100 (highest quality). This parameter only applies when the image format is set to JPEG, allowing you to balance between image quality and file size.
delimiter
A character or string used to separate different parts of the filename, such as the prompt, timestamp, and numbering. This helps in creating a structured and readable filename.
prompt_words_limit
Limits the number of words from the prompt that are included in the filename. This helps in keeping filenames concise and manageable, especially when dealing with long prompts.
embed_workflow
A boolean parameter that determines whether to embed the workflow information into the image metadata. This can be useful for documenting the process and settings used to generate the image.
save_json_metadata
A boolean parameter that, when enabled, saves additional metadata in a separate JSON file alongside the image. This can include prompts, timestamps, and other relevant information, providing a comprehensive record of the image's creation.
enable_filename_numbering
A boolean parameter that enables automatic numbering of filenames, which is useful for organizing images in a sequence. This helps in maintaining order when saving multiple images.
filename_number_padding
Specifies the number of digits to use for numbering in filenames. This ensures consistent filename lengths, which can be important for sorting and organization.
filename_number_start
Sets the starting number for filename numbering. This allows you to continue numbering from a specific point, which can be useful when adding to an existing collection of images.
embed_png_metadata
A boolean parameter that determines whether to embed metadata directly into PNG files. This includes prompts, timestamps, and other information, making it accessible directly from the image file.
output_path
Specifies the directory where the images will be saved. This allows you to organize your images into specific folders based on your workflow or project structure.
filename_prefix
A string that is added at the beginning of each filename. This can be used to categorize or label images, making it easier to identify them at a glance.
negative_prompt_list
A list of negative prompts associated with the images. Similar to the prompt_list, this parameter allows you to embed additional contextual information into the image metadata.
json_folder
Specifies the directory where JSON metadata files will be saved if save_json_metadata is enabled. This allows you to keep metadata files organized separately from the images.
prompt
An optional parameter that can include additional prompt information to be embedded in the metadata. This can be useful for complex workflows where multiple prompts are used.
extra_pnginfo
Allows you to include additional custom metadata in PNG files. This parameter accepts a dictionary of key-value pairs, providing flexibility to store any extra information you deem necessary.
Image Saver Output Parameters:
saved_paths
This output parameter provides a list of file paths where the images have been saved. It is essential for verifying that the images have been stored correctly and for accessing them later. The paths include the full directory and filename, ensuring you can easily locate each saved image.
Image Saver Usage Tips:
- To maintain a consistent and organized file structure, use the
filename_prefixanddelimiterparameters effectively. This will help you categorize images and make filenames more readable. - When working with large batches of images, enable
enable_filename_numberingto automatically number your files, ensuring they are saved in a sequential order. - If you need to preserve detailed information about the image creation process, enable
embed_workflowandsave_json_metadatato store comprehensive metadata alongside your images.
Image Saver Common Errors and Solutions:
ValueError: Expected 3D tensor for image <number>, got shape <shape>
- Explanation: This error occurs when the input image data does not have the expected three-dimensional shape, which is necessary for processing and saving.
- Solution: Ensure that your input images are correctly formatted as 3D tensors or arrays. Check the dimensions of your image data before passing it to the node.
FileNotFoundError: No such directory: <output_path>
- Explanation: This error indicates that the specified output directory does not exist, preventing the node from saving the images.
- Solution: Verify that the
output_pathparameter points to a valid directory. Create the directory if it does not exist before running the node.
IOError: Cannot save image in format <image_format>
- Explanation: This error occurs when there is an issue with saving the image in the specified format, possibly due to unsupported image modes or incorrect format settings.
- Solution: Check that the image data is compatible with the chosen format. For example, ensure that images saved as JPEG are in RGB mode, as JPEG does not support alpha channels.
