ComfyUI Node

Print Image

Read your tensor's mind

By yanhuifair·Created 2 years ago·Updated 3 months ago· 2
Print Image
  • image
    log

    An image in ComfyUI isn't a picture, it's a tensor - [B, C, H, W] of floats in [0, 1] - and when something downstream misbehaves, the answer usually lives in that tensor's shape and values, not in how the preview looks. Print Image dumps an IMAGE tensor's details to the backend console so you can see what you're actually feeding your pipeline.

    It's the image-flavored sibling of the pack's Print Any: same idea, one specific type, formatted for the debugging job. Where it shines is catching the silent failures that previews hide - a batch that collapsed to zero images, a channel count that's suddenly 4 when you expected 3, a value range that drifted out of [0,1] after some arithmetic.

    Inputs and outputs

    • image (IMAGE) in - the tensor to inspect.
    • log (STRING) - a label printed first, so you can find this print among the noise.

    No outputs - it's a terminal node that always runs.

    How it works

    It prints the log label, then image.shape (your [B, C, H, W]), then the tensor itself. The shape line is the useful one for 95% of debugging: it tells you instantly whether you have a batch where you wanted a single image, or an unexpected alpha channel. The full tensor dump is there when you need to check actual values.

    Where it fits

    Anywhere images meet other nodes and the result is wrong. Shape mismatches, batch-count surprises, and channel errors all announce themselves here long before you'd spot them in a preview. Drop it on a wire, run once, read the console, delete it.

    Install

    FairLab installs as one pack via ComfyUI Manager (search ComfyUI-FairLab) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
    cd ComfyUI-FairLab
    pip install -r requirements.txt
    

    Restart, then find it under Fair/utility. No extra dependencies.

    Gotchas

    • Output lands in the backend console, not the UI - the terminal where ComfyUI runs (or docker logs in a container).
    • The full tensor print for a big image is a wall of numbers. If you just need the shape, look at the first line and ignore the rest.
    • It always runs, so leaving it on a hot wire adds execution overhead to that branch every run. Debug, fix, remove.
    CategoryFair/utility

    Inputs (2)

    NameTypeDefaultDescription
    imageIMAGE
    logSTRING

    Outputs (0)

    No outputs