2023-12-23 20:02:07 +01:00
2023-12-29 17:00:08 +01:00
2024-01-02 20:37:34 +01:00
2023-12-29 17:00:08 +01:00
2023-12-29 17:00:08 +01:00
2024-01-05 00:17:46 +01:00
2023-12-29 17:00:08 +01:00
2023-12-23 20:02:07 +01:00
2023-12-23 19:54:06 +01:00
2023-12-23 20:02:07 +01:00
2024-01-02 20:37:34 +01:00
2023-12-23 20:02:07 +01:00

ComfyUI-Crystools Hits Donate

A powerful set of tools for your belt when you work with ComfyUI

You can see the metadata and compare between two images, compare between two JSONs, show any value to console/display, pipes, and more!
This provides a better nodes to load images, previews, etc, and see "hidden" data, but without load a new workflow.

Show metadata

Table of contents


Metadata

Node: Metadata extractor

This node is used to extract the metadata from the image and handle it as a JSON as source for other nodes.
You can see all information, even metadata from others sources (like photoshop, see sample).

The input comes from the load image with metadata or preview from image nodes (an others in the future).

Metadata extractor

Sample: metadata-extractor.json

Other metadata sample (photoshop)

With metadata from Photoshop Metadata extractor

Parameters
  • input:
    • metadata_raw: The metadata raw from the image or preview node
  • Output:
    • prompt: The prompt used to produce the image.
    • workflow: The workflow used to produce the image (all information about nodes, values, etc).
    • file info: The file info of the image/metadata (resolution, size, etc) as human readable.
    • raw to JSON: The entire metadata raw but formatted/readable.
    • raw to property: The entire metadata raw as "properties" format.
    • raw to csv: The entire metadata raw as "csv" format.

Node: Metadata comparator

This node is so useful to compare two metadata and see the differences (the main reason why I created this extension!)

You can compare 3 inputs: "Prompt", "Workflow" and "Fileinfo"

There are tree potential "outputs": values_changed, dictionary_item_added, dictionary_item_removed (in this order of priority).

Metadata extractor

Sample: metadata-comparator.json

Notes:

  • I use DeepDiff for that, for more info check the link.
  • If you want to compare two JSONs, you can use the JSON comparator node.
Parameters
  • options:
    • what: What to compare, you can choose between "Prompt", "Workflow" and "Fileinfo"
  • input:
    • metadata_raw_old: The metadata raw to start compare
    • metadata_raw_new: The metadata raw to compare
  • Output:
    • diff: This is the same output you can see in the display of the node, you can use it on others nodes.


Debugger

Node: Show Metadata

With this node, you will be able to see the JSON produced from your entire prompt and workflow so that you can really know all the values (and more) of your prompt quickly without the need to open the file (PNG or JSON).

Show metadata

Sample: debugger-metadata.json

Parameters
  • Options:
    • Active: Enable/disable the node
    • Parsed: Show the parsed JSON or plain text
    • What: Show the prompt or workflow (prompt are values to produce the image, and workflow is the entire workflow of ComfyUI)

Node: Show any

You can see on the console or display any text or data from the nodes. Connect it to what you want to inspect, and you will see it.

Show any

Sample: debugger-any.json

Parameters
  • Input:
    • any_value: Any value to show, can be a string, number, etc.
  • Options:
    • Console: Enable/disable write to console
    • Display: Enable/disable write on this node
    • Prefix: Prefix to console

Node: Show any to JSON

As same the previous one, but it formatted the value to JSON (only display).

Show any

Sample: debugger-json.json

Parameters
  • Input:
    • any_value: Any value to try to convert to JSON
  • Output:
    • string: The same string is shown on display


Image

Node: Load image with metadata

This node is the same as the default one, but it adds three features: Prompt, Metadata, and supports subfolders of the "input" folder.

Load image with metadata

Sample: image-load.json

Parameters
  • Input:
    • image: Read the images from the input folder (and subfolder) (you can drop the image here, or even paste an image from clipboard)
  • Output:
    • Image/Mask: The same as the default node
    • Prompt: The prompt used to produce the image (not the workflow)
    • Metadata RAW: The metadata raw of the image (full workflow) as string

Note: The subfolders support inspired on: comfyui-imagesubfolders


Node: Save image with extra metadata

This node is the same as the default one, but it adds two features: Save the workflow or not in the png, and you can add any piece of metadata (as JSON).

This save custom data on the image, so you can share it with others, and they can see the workflow and metadata (see preview from metadata), even your custom data.

It can be any type of information supports text and JSON.

Save image with extra metadata

Sample: image-save.json

Parameters
  • options:
    • with_workflow: If you want to save into the image the workflow (special to share the workflow with others)
  • Input:
    • image: The image to save (same as the default node)
  • Output:
    • Metadata RAW: The metadata raw of the image (full workflow) as string

Note: The data is saved as special "exif" (as ComfyUI do) in the png file, you can read it with Load image with metadata.

Important:

  • If you want to save your workflow with a particular name, and your data as creator, you need to use the ComfyUI-Crystools-save extension, try it! Crystools-save

Node: Preview from image

This node is used to preview the image with the current prompt and additional features.

Preview from image

Feature: It supports cache (shows as "CACHED") (not permanent yet!), so you can disconnect the node and still see the image and data, so you can use it to compare with others!

Preview from image

As you can see the seed, steps, and cfg were changed

Sample: image-preview-image.json

Parameters
  • Input:
    • image: Any kind of image link
  • Output:
    • Metadata RAW: The metadata raw of the image and full workflow.
      • You can use it to compare with others (see metadata comparator)
      • The file info like filename, resolution, datetime and size with the current prompt, not the original one! (see important note)

Important:

  • If you want to read the metadata of the image, you need to use the load image with metadata and use the output "metadata RAW" not image link.
  • To do a preview it is necessary save it first on temporal folder, and the data shown is from the temporal image, not the original one even the prompt!

Node: Preview from metadata

This node is used to preview the image from the metadata and shows additional data (all around this one).
It supports same features as preview from image (cache, metadata raw, etc.). But the important difference is you see real data from the image (not the temporal one either current prompt).

Preview from metadata

Sample: image-preview-metadata.json


Node: Show resolution

This node is used to show the resolution of an image.

Can be used with any image link.

Show resolution

Sample: image-resolution.json

Parameters
  • Input:
    • image: Any kind of image link
  • Output:
    • Width: The width of the image
    • Height: The height of the image


Pipe

Nodes: Pipe to/edit any, Pipe from any

This powerful set of nodes is used to better organize your pipes.

The "Pipe to/edit any" node is used to encapsulate multiple links into a single one. It includes support for editing, easily adding the modified content back to the same pipe number.

The "Pipe from any" node is used to extract the content of a pipe.

Typical example:

Pipes

With pipes:

Pipes

Sample: pipe-1.json

Editing pipes:

Pipes

Sample: pipe-2.json

Parameters
  • Input:
    • CPipeAny: This is the type of this pipe you can use it to edit (see the sample)
    • any_*: 6 possible inputs to use
  • Output:
    • CPipeAny: You can continue the pipe with this output, you can use it to bifurcate the pipe (see the sample)

Important:

  • Please note that it supports "any," meaning it does not validate (not yet!) the correspondence of input nodes with the output ones. When creating the link, it is recommended to link consciously number by number.
  • "RecursionError", It's crucial to note that the flow of links must be in the same direction, and they cannot be mixed with other flows that use the result of this one. Otherwise, this may lead to recursion and block the server (you need to restart it!)
Bad example with "RecursionError: maximum recursion depth exceeded"

If you see on your console something like this, you need to check your pipes. That is bad sample of pipes, you can't mix the flows. Pipes



Utils

Some useful nodes to use in your workflow.

Node: JSON comparator

This node is so useful to compare two JSONs and see the differences.

JSON comparator

Sample: utils-json-comparator.json

Parameters
  • input:
    • json_old: The first json to start compare
    • json_new: The json to compare
  • Output:
    • diff: A new JSON with the differences

Notes:
As you can see, it is the same as the metadata comparator but with JSONs.
The other is intentionally simple to compare two images metadata, this is more generic.
The main difference is that you can compare any JSON, not only metadata.


Node: Stats system

This node is used to show the stats of the system (RAM, VRAM and Space).
It should connect as a pipe.

JSON comparator

Sample: utils-stats.json

Parameters
  • input:
    • latent: The latent to use to measure the stats
  • Output:
    • latent: Return the same latent to continue the pipe

Notes: The original is in WAS, I only show it on the display.



Primitives

Nodes: Primitive boolean, Primitive integer, Primitive float, Primitive string, Primitive string multiline

A set of nodes with primitive values to use in your prompts.

Primitives



List

A set of nodes with list of values (any or strings/texts) for any propose (news nodes to use it coming soon!).

Important: You can use with others nodes like "Show any" to see the values of the list

Node: List of strings

Feature: You can concatenate them.

Lists

Sample: list-strings.json

Parameters
  • Input:
    • string_*: 8 possible inputs to use
    • delimiter: Use to concatenate the values on output
  • Output:
    • concatenated: A string with all values concatenated
    • list_string: The list of strings (only with values)

Node: List of any

You can concatenate any value (it will try to convert to string and show the value), so util to see several values at the same time.

Lists

Sample: list-any.json

Parameters
  • Input:
    • any_*: 8 possible inputs to use
  • Output:
    • list_any: The list of any elements (only with values)


Switch

A set of nodes to switch between flows.

All switches are boolean, you can switch between flows by simply changing the value of the switch.
You have predefined switches (string, latent, image, conditioning) but you can use "Switch any" for any value/type.

Switches

Sample: switch.json



About

Notes from the author:

  • This is my first project in python ¯\(ツ)/¯ (PR are welcome!)
  • I'm software engineer but in other languages (web technologies)
  • My instagram is: https://www.instagram.com/crystian.ia I'll publish my works on it, consider follow me for news! :)
  • I'm not a native english speaker, so sorry for my english :P

To do

  • [✅] Review the priority of list of nodes
  • [❌] Add support for others image formats (jpg, gif, etc.) - nope, I don't need it, it's complicated
  • Several unit tests
  • Add permanent cache for preview/metadata image (to survive to F5! or restart the server)

Changelog

Crystools-save: 1.0.0 (29/12/2023)

1.1.0 (29/12/2023)

  • Node added: "Save image with extra metadata"
  • Support to read Jpeg metadata added (not save)

1.0.0 (26/12/2023)

  • First release

Installation

Install from GitHub

  1. Install ComfyUi.
  2. Clone this repo into custom_modules:
    cd ComfyUI/custom_nodes
    git clone https://github.com/crystian/ComfyUI-Crystools.git
    cd ComfyUI-Crystools
    pip install -r requirements.txt
    
  3. Start up ComfyUI.

Install from manager

Search for crystools in the manager and install it.


Use

You can use it as any other node, just using the menu in the category crystools or double click on the canvas (I recommended to use the "oo" to fast filter), all nodes were posfixing with [Crystools].

Menu shortcut

If for some reason you need to see the logs, you can define the environment variable CRYSTOOLS_LOGLEVEL and set the value.


Made with ❤️ by Crystian.

S
Description
No description provided
Readme MIT
16 MiB
Languages
Python 41.9%
JavaScript 32.2%
TypeScript 23.7%
CSS 1.8%
Shell 0.4%