Nodes/ComfyUI-Keyframed/KfDebug_Image
ComfyUI Node

KfDebug_Image

Read an image tensor's shape before it bites you

By dmarx·Created 3 years ago·Updated 2 years ago· 92
KfDebug_Image
  • item
  • IMAGE
labeldebugging passthrough

If a node downstream of your image is silently doing the wrong thing, the first question is almost always "what is actually in this wire?" That's the question KfDebug_Image answers - but like every node in the KfDebug_* family, it answers it in the console, not on the canvas. Wire an image in, and ComfyUI's terminal gets a line about its type, its tensor shape, and its dtype while the same image passes through untouched to whatever you had connected.

Why you'd reach for it

Images in ComfyUI are tensors shaped [B, H, W, C], and the batch dimension is where the silent failures live. You decode a latent with 16 frames in it, feed the result into a node that assumes a single image, and get either an error or a weird result. KfDebug_Image tells you the actual shape on the wire - is it [1, 512, 512, 3] or [16, 512, 512, 3]? - so you know whether the problem is upstream (your latent batch is wrong) or downstream (the consumer doesn't handle batches).

It's also the cheapest way to confirm a pipeline segment produced output at all. In this pack's natural habitat - AnimateDiff-era prompt-scheduling workflows where a KfGetScheduleConditionSlice batch has to line up with a latent batch frame-for-frame - verifying the image side of that alignment before you sample is exactly the kind of check that saves a half-hour of baffling output.

The inputs that matter

  • item - the IMAGE tensor to inspect, force-input from a wire.
  • label - multiline string, default "debugging passthrough". Every debug node logs this line first, so when your console is full of noise, a distinct label like "first pass decode" makes your inspection greppable.

The single output, IMAGE, is the identical image you fed in - pure passthrough, so you can keep the debug node in the live path without changing anything.

How it works

The whole family shares one inspector. It logs the type, then checks for dtype and shape (both present on image tensors), and falls back to checking mode if the thing turns out to be a PIL Image rather than a tensor. You'll see something like:

label: first pass decode
type: <class 'torch.Tensor'>
item.dtype: torch.float32
item.shape: torch.Size([16, 512, 512, 3])

If you're used to PreviewImage for eyeballing results, note the difference: this is for facts (shape, dtype, is-it-a-batch) not for looking at the picture. Keep a preview node for aesthetics, use this when you need to know what the data actually is.

Installing it

It's part of ComfyUI-Keyframed (dmarx's pack wrapping his keyframed library). ComfyUI Manager: search "Keyframed". Or:

cd ComfyUI/custom_nodes
git clone https://github.com/dmarx/ComfyUI-Keyframed

Restart ComfyUI. The pack pip-installs keyframed and toolz on first load and needs no model downloads - the debug nodes are pure utility.

Troubleshooting

The shape in the log doesn't match what you expected? Don't blame the debug node - it's a passthrough, it's honest. Check the node that produced the image. And remember: no canvas output means no canvas output. If you're looking for a preview in the UI, this isn't the node. If you're looking at the terminal and seeing nothing at all, make sure you actually restarted ComfyUI after install so the pack registered.

Categorykeyframed/debug

Inputs (2)

NameTypeDefaultDescription
itemIMAGE
labelSTRINGdebugging passthrough

Outputs (1)

NameTypeDescription
IMAGEIMAGE