Nodes Browser

ComfyDeploy: How Image Metadata Nodes works in ComfyUI?

What is Image Metadata Nodes?

Nodes for loading and saving images with metadata in ComfyUI.

How to install it in ComfyDeploy?

Head over to the machine page

  1. Click on the "Create a new machine" button
  2. Select the Edit build steps
  3. Add a new step -> Custom Node
  4. Search for Image Metadata Nodes and select it
  5. Close the build step dialig and then click on the "Save" button to rebuild the machine

ComfyUI Image Metadata Nodes

Version: 1.0.1
Author: Light-x02

Support My Work

If you find this project useful, you can support my work on Ko-fi:
https://ko-fi.com/light_x02

Description

This project provides two complementary nodes for ComfyUI, allowing you to load and save images while preserving their metadata intact. These nodes are particularly useful for workflows that require image adjustments, such as upscaling, without altering the original metadata.

How It Works

Metadata Loading

The Image Metadata Loader node imports an image while extracting its original metadata, which can then be passed to other nodes.

Metadata Saving

The Image Metadata Saver node saves an image with its original, unchanged metadata embedded directly in the generated PNG file.

By connecting these two nodes through the METADATA output/input, you can import a previously generated image with correct metadata, modify it (e.g., using upscaling), and save it while preserving the metadata intact.

Features

  • Supported Formats: Load and save in PNG format (metadata is directly embedded in the file).
  • Dynamic Metadata Management: Preserves original metadata, even in complex workflows.
  • Advanced Compatibility: Metadata is correctly embedded in the final PNG file.

Installation

Method 1: Install via ComfyUI Manager

  1. Open ComfyUI.
  2. Go to the Custom Nodes section in the interface.
  3. Search for "Image Metadata Nodes" and install it directly from the ComfyUI Manager.
  4. Restart ComfyUI
    Restart ComfyUI to load the nodes.

Method 2: Clone the Repository

  1. Open a terminal or command prompt.
  2. Run the following command to clone the repository:
    git clone https://github.com/Light-x02/ComfyUI-Image-Metadata-Nodes.git
    
  3. Restart ComfyUI
    Once the files are in place, restart ComfyUI to load the nodes.

Manual Installation

  1. Download or Clone the Project
    https://github.com/Light-x02/ComfyUI-Image-Metadata-Nodes

  2. Move the Folder to Your ComfyUI Directory
    Copy the folder ComfyUI_Image_Metadata into the custom_nodes directory of your ComfyUI installation.

  3. Restart ComfyUI
    Once the files are in place, restart ComfyUI to load the nodes.

Usage

Included Nodes

Image Metadata Loader

  • Description: Loads an image and extracts its metadata.
  • Outputs:
  • IMAGE: The loaded image.
  • METADATA: The raw metadata.

Image Metadata Saver

  • Description: Saves an image with unchanged metadata.
  • Inputs:
  • IMAGE: The image to save.
  • METADATA: The metadata to include.
  • Options:
  • Filename Prefix: Prefix for the file name (e.g., %date:yyyy-MM-dd%).
  • Subdirectory Name: Name of the subdirectory for saving files.

Example Workflow

  1. Use the Image Metadata Loader node to load an image and retrieve its metadata.
  2. Modify the image (e.g., with an upscaling or retouching node).
  3. Connect the METADATA output of the loader to the METADATA input of the saver.
  4. Use Image Metadata Saver to save the image with intact metadata.

Workflow Example

Additional Notes

To save metadata in my PNG files when generating images with txt2img workflows, I use the extension "ComfyUI-ImageMetadataExtension", which is available here. This ensures that platforms like Civitai automatically detect the metadata.

Contribution

Contributions are welcome! If you want to report a bug or suggest an improvement, open an issue or submit a pull request on the GitHub repository.