Nodes/ComfyUI Color Profile Reader/Compare Image Gamma Values
ComfyUI Node

Compare Image Gamma Values

Two images look identical but don't match? This node checks whether their gamma does

By APZmedia·Created 11 months ago·Updated 5 months ago· 7
Compare Image Gamma Values
    • comparison_json
    • gamma_analysis
    • recommendations
    image_path_1
    image_path_2
    tolerance0.010

    Ever swapped one image for another in a pipeline and watched the colors subtly shift even though both look "fine" on their own? Nine times out of ten that's a gamma mismatch - one file was encoded with sRGB's 2.2 transfer curve, the other with something flatter, and nothing in the usual ComfyUI chain bothers to check. GammaCompare is the node that does the checking: it reads two images from disk, extracts their gamma, and tells you whether they actually agree, within a tolerance you set.

    How it works

    It reads the same profile data as the pack's ColorProfileReader (Pillow plus manual PNG chunk parsing), but for two files at once. Then it compares their gamma values against a table of standards - sRGB at 2.2, Rec. 2020 at 2.4, DCI-P3 at 2.6, Linear at 1.0, old Mac at 1.8, and so on - and reports which standard each image is closest to, how far apart the two are, and how severe the mismatch is.

    Where people get burned: it's file paths, not image tensors. image_path_1 and image_path_2 are strings pointing at files on disk, same as ColorProfileReader. You can't wire a VAE Decode output into it. If you're comparing two generated outputs, save them first and point the node at the saved files.

    The inputs that matter

    • image_path_1 / image_path_2 - the two files. That's the whole job.
    • tolerance - how close counts as "matching," from 0.001 to 0.1, default 0.01. For strict color-managed work keep it at the low end; 0.01 is already generous since typical gammas differ by whole tenths. If you just want a quick sanity check on a casual pipeline, relax it a bit so minor rounding doesn't scream.

    What you get back

    Three JSON strings, all meant for reading or for automation:

    • comparison_json - per-image gamma, container, ICC presence and profile name, plus the raw difference and whether it's within tolerance.
    • gamma_analysis - which standard gamma each image matches, the percentage difference, and a severity rating.
    • recommendations - plain-language workflow advice for the mismatch, e.g. what to convert to bring the two files into agreement.

    So the node is as much a QC tool as a diagnostic: put it after a save step in a batch pipeline and it'll flag the file that came out of the chain with the wrong transfer curve.

    Install and gotchas

    Same as the rest of the pack - ComfyUI Manager, search "ComfyUI Color Profile Reader", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/APZmedia/ComfyUI-color-tools
    

    Restart after. Note the README's clone URL is a placeholder (yourusername/...) - use APZmedia/ComfyUI-color-tools or it won't resolve. This node only needs Pillow, which ComfyUI already ships, so no extra installs here. One honest caveat: gamma detection is only as good as the metadata the file carries. A JPEG with no embedded profile and no gAMA chunk just won't have a gamma value to compare, and the node will tell you the comparison is inconclusive rather than fabricate one. That's the right behavior - treat a missing gamma as a finding, not a bug.

    CategoryImage/Color

    Inputs (3)

    NameTypeDefaultDescription
    image_path_1STRING
    image_path_2STRING
    toleranceFLOAT0.0100.001–0.1

    Outputs (3)

    NameTypeDescription
    comparison_jsonSTRING
    gamma_analysisSTRING
    recommendationsSTRING