JH XMP Metadata Nodes

Custom nodes for loading and saving images with embedded XMP metadata (https://www.adobe.com/products/xmp.html).

When I generate tens or hundreds of images from ComfyUI they all go into a folder and get forgotten because I have no practical way to find them again. Embedded metadata solves this problem. When metadata is present in a file, both macOS and Windows index it automatically, making it searchable from the Finder on the Mac or the File Explorer in Windows.


image   image

image  

Apps like Photoshop and Lightroom expose XMP metadata and allow it to be viewed or edited.


image   image

Supported Properties

The following metadata properties are currently supported:

Property Description
dc:creator A creator or list of creators of the image. Items can be separated by commas (John Doe, Jane Doe) or semicolons (John Doe; Jane Doe)
dc:rights Information about the rights and clearances associated with the image, if any.
dc:title A title for the image.
dc:description A description of the image.
dc:subject A subject or list of subjects. Items can be separated by commas (wetsuit, sunset) or semicolons (wetsuit; sunset)
photoshop:Instructions Special instructions.
exif:UserComment Any user-provided comment about the image.
Iptc4xmpCore:AltTextAccessibility Alt. text that can (in principle) be used by assistive technologies.
Iptc4xmpCore:ExtDescrAccessibility A longer, more detailed elaboration of the Iptc4xmpCore:AltTextAccessibility property

Getting Started

Installing from GitHub

  1. Install ComfyUI

  2. Clone this repository into the custom_nodes folder:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ComfyUI-JH/ComfyUI_JH_XMP_Metadata_Nodes.git
    
  3. Install the required Python packages. If you're using venv and pip that looks like this:

    cd ComfyUI_JH_Misc_Nodes
    pip install -r requirements.txt
    

    If you're using Poetry, then it's just

    cd ComfyUI_JH_Misc_Nodes
    poetry install
    

Nodes

Load Image With XMP Metadata

image

Just like the built-in Load Image node except if XMP metadata is embedded in the image it will be parsed and made available on the node's outputs. The xml_string output carries the entire XML data structure including metadata which is not specifically supported by this package.

Save Image With XMP Metadata

image

Saves any images piped into it with embedded XMP metadata. All inputs (except images) are optional. Can save in a variety of file formats: JPEG, PNG (with and without embedding the ComfyUI workflow), WebP (lossy and lossless).

Get Widget Value

image

Can be used to get the string, int or float value of any widget on any node. Simply pipe the node into this node's input and type in the name of the widget you want the value of.

Path to Stem

image

Given a path string (absolute or relative), this node returns the "stem," meaning the filename alone minus any extension.

Format Metadata

image

This utility node takes common workflow inputs (prompt, model_name, seed, etc.) and allows you to construct a string that can subsequently be piped into a Save Image With XMP Metadata node input to embed metadata however you choose.

Credits

This software includes source code from other products:

Product Code Used License
ComfyUI Code from the Load Image and Save Image nodes. GitHub License
ComfyUI-Custom-Scripts The AnyType class and its implementation. GitHub License
S
Description
No description provided
Readme GPL-3.0
432 KiB
Languages
Python 100%