Nodes/ComfyUI_MatAnyone_Kytra/Images To RGB Kytra
ComfyUI Node

Images To RGB Kytra

The quiet fix for ComfyUI's channel-count errors

By KytraScript·Created about a year ago·Updated about a year ago· 153
Images To RGB Kytra
  • images
  • IMAGE

This one's a utility node, and it's about as small as ComfyUI nodes get: one input, one output, no parameters to tune. It ships inside the same pack as MatAnyoneVideoMatting and it does exactly what the name says - takes an image batch and hands back an image batch guaranteed to be plain RGB.

Worth being upfront about the source here: the pack's README documents the matting node in detail and doesn't say a word about this one. So the read below is inference from the class name, the schema and how ComfyUI's image tensors behave in practice - not a quoted description from the author. If you're doing something this node doesn't cover, that's why.

Why you'd want this

ComfyUI passes images around as tensors, and those tensors don't always have the same number of channels. Most of the time everything's 3-channel RGB and you never think about it. But once you start doing anything alpha-aware - masking, compositing, matting, loading a PNG that happens to have transparency baked in - it's easy to end up with a 4-channel RGBA image sitting in your graph. Plenty of downstream nodes, video encoders especially, expect exactly 3 channels and will throw a channel-mismatch error the moment a stray alpha channel shows up. This node is the safety valve you drop in front of one of those: strip whatever extra channel got attached and pass through clean RGB.

That makes it a natural fit right where it lives - after a matting pipeline like MatAnyone's, where you've been juggling alpha mattes and composited foregrounds, is exactly the kind of place a 4-channel tensor sneaks into your graph without you doing it on purpose.

The input and output that matter

There's really just the one pair:

  • images (IMAGE) - whatever batch you want normalized. Doesn't matter if it's already RGB or has picked up an alpha channel somewhere upstream.
  • IMAGE (IMAGE) out - the same batch, guaranteed 3-channel.

No toggles, no thresholds, nothing to configure. You wire it in, it does its one job, you move on.

How to install it

Same pack as MatAnyoneVideoMatting, so it's the same install - you get both nodes together, there's no way to grab one without the other.

Through ComfyUI Manager: search "ComfyUI_MatAnyone_Kytra" and install.

Manually:

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

This node itself doesn't need any model weights - the download-on-first-run behavior in this pack belongs entirely to the matting node, not this one. Restart ComfyUI after installing and it'll show up under the Kytra-MatAnyone category.

Common issues & troubleshooting

Honestly, there isn't much to trip over here - that's the appeal of a node this small. The one thing worth flagging: if you installed this pack purely for this node and skipped the matting node's setup, you shouldn't need to. Kytra_Images_To_RGB doesn't touch the MatAnyone model or its weights, so it should load and run fine even before that first-run download finishes. If it's throwing an error at import time regardless, that's more likely the shared pack's pip install -r requirements.txt step being skipped than anything specific to this node - go back and make sure that ran cleanly.

Beyond that, treat it as plumbing: if a node downstream is complaining about the number of channels in an image, put this in front of it and the complaint should go away.

CategoryKytra-MatAnyone

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE