MCPcopy
hub / github.com/crystian/ComfyUI-Crystools

github.com/crystian/ComfyUI-Crystools @1.26.0 sqlite

repository ↗ · DeepWiki ↗ · release 1.26.0 ↗
323 symbols 575 edges 71 files 14 documented · 4%
README

comfyui-crystools Donate Open in Colab

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

With this suit, you can see the resources monitor, progress bar & time elapsed, metadata and compare between two images, compare between two JSONs, show any value to console/display, pipes, and more! This provides better nodes to load/save images, previews, etc, and see "hidden" data without loading a new workflow.

Show metadata

Table of contents


General

Resources monitor

🎉Finally, you can see the resources used by ComfyUI (CPU, GPU, RAM, VRAM, GPU Temp and space) on the menu in real-time!

Horizontal:
Monitors

Vertical:
Monitors

Now you can identify the bottlenecks in your workflow and know when it's time to restart the server, unload models or even close some tabs!

You can configure the refresh rate which resources to show:

Monitors

Notes: - The GPU data is only available when you use CUDA (only NVIDIA cards, sorry AMD users). - This extension needs ComfyUI 1915 (or higher). - The cost of the monitor is low (0.1 to 0.5% of utilization), you can disable it from settings (Refres rate to 0). - Data comes from these libraries: - psutil - torch - pynvml (official NVIDIA library)

Progress bar

You can see the progress of your workflow with a progress bar on the menu!

Progress bar

https://github.com/crystian/comfyui-crystools/assets/3886806/35cc1257-2199-4b85-936e-2e31d892959c

Additionally, it shows the time elapsed at the end of the workflow, and you can click on it to see the current working node.

Notes: - If you don't want to see it, you can turn it off from settings (Show progress bar in menu)

Metadata

Node: Metadata extractor

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

The input comes from the load image with metadata or preview from image nodes (and 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) is human readable.
  • raw to JSON: The entire metadata is raw but formatted/readable.
  • raw to property: The entire metadata is raw in "properties" format.
  • raw to csv: The entire metadata is raw in "csv" format.

Node: Metadata comparator

This node is so useful for comparing two metadata and seeing the differences (the main reason why I created this extension!)

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

There are three potential "outputs": values_changed, dictionary_item_added, and 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 comparing
  • 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 other 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 know all the values (and more) of your prompt quickly without opening 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, which 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

It is the same as 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 the 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 the 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 in the png or not, and you can add any piece of metadata (as JSON).

This saves 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 that 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 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 does) 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 the image link. - To do a preview, it is necessary to save it first on the 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 the 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 or the 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 and 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 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 something like this on your console, 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 system stats (RAM, VRAM, and Space).
It should connect as a pipe.

JSON comparator

Sample: [utils-stats.json](./samples/utils

Extension points exported contracts — how you extend this code

IWidget (Interface)
(no doc)
web/comfy/liteGraph.d.ts
IWidget (Interface)
(no doc)
web/comfy/liteGraph.ts
ComfyApp (Interface)
(no doc)
web/comfy/typings/comfy.d.ts
ComfyWidget (Interface)
(no doc)
web/comfy/typings/comfy.d.ts
ComfyGraphNode (Interface)
(no doc)
web/comfy/typings/comfy.d.ts

Core symbols most depended-on inside this repo

registerExtension
called by 10
web/comfy/typings/comfy.d.ts
displayContext
called by 6
web/common.js
convertNumberToPascalCase
called by 6
web/utils.js
formatBytes
called by 6
web/utils.js
findJsonsDiff
called by 4
core/common.py
startMonitor
called by 3
general/monitor.py
buildMetadata
called by 3
nodes/image.py
stopMonitor
called by 2
general/monitor.py

Shape

Method 156
Class 86
Function 41
Interface 28
Enum 8
Route 4

Languages

Python56%
TypeScript44%

Modules by API surface

web/comfy/typings/litegraph.d.ts34 symbols
nodes/switch.py34 symbols
nodes/image.py26 symbols
web/comfy/typings/comfy.d.ts25 symbols
nodes/primitive.py20 symbols
general/gpu.py13 symbols
nodes/parameters.py10 symbols
server/monitor.py8 symbols
nodes/pipe.py8 symbols
nodes/list.py8 symbols
nodes/debugger.py8 symbols
general/hardware.py8 symbols

Dependencies from manifests, versioned

@typescript-eslint/eslint-plugin6.18.1 · 1×
@typescript-eslint/parser6.18.1 · 1×
eslint8.56.0 · 1×
eslint-plugin-import2.29.1 · 1×
typescript5.3.3 · 1×
Pillow9.5.0 · 1×
deepdiff
py-cpuinfo
pynvml
torch

For agents

$ claude mcp add ComfyUI-Crystools \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact