Recast Image
The no-op that fixes broken links
- image
- IMAGE
Recast Image is the pixel-space member of the Typecaster family, and the family's core promise is honest about being boring: it takes an IMAGE in and returns the same IMAGE out, unchanged. You install it for one reason - to make finicky links load.
ComfyUI wires by declared type, and most nodes are well-behaved: an IMAGE socket only accepts IMAGE. But the ecosystem is full of nodes that accept "anything" - utility packs love a wildcard input that can take images, masks, latents, or text, and only figure out which one they got when they run. That laziness bites on workflow load. When an anything-node feeds into a typed socket, the browser sometimes can't resolve the type until the first queue pass, so the workflow opens with a red connection or a node that fails to initialize. The docstring in this node's own source describes the scenario: nodes from other packages that can take dynamic things will sometimes fail to set themselves up on first load, and "putting one of these in the chain will help those link up knowing their input types."
So Recast Image is a concrete typed island you drop into the wire. The anything-output feeds the cast's IMAGE input; the cast's IMAGE output goes to whatever wanted pixels. The graph now sees an explicit IMAGE type from the moment it loads, no queue-and-fail round trip required. The author's README puts it as a cast in code - emptyLatent = (Latent)emptyLatent; - which is exactly right: you're changing the declared type, not the value. onRun is a straight return (image,).
The whole interface
One input, one output. That's it - no widgets, no settings.
- image (IMAGE) - in.
- IMAGE - out.
Installing it
It's part of the ComfyKit Custom Nodes pack (bobmagicii/comfykit-custom-nodes). In ComfyUI Manager, search "ComfyKit Custom Nodes". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/bobmagicii/comfykit-custom-nodes
Restart ComfyUI. No requirements.txt, no model downloads - the whole pack is plain Python over ComfyUI's core modules.
What it can and can't do
It cannot corrupt your image - by construction. It also can't repair one: if the upstream "anything" is actually a latent or a mask, Recast Image will just tell the downstream it's an IMAGE, and whatever was broken about that mismatch is still broken, now with a type label. If the wire stays red after the cast, check you're casting to the type the destination genuinely wants - for pixels that's IMAGE; if the destination actually takes LATENT, you want Recast Latent instead. Same idea, different socket.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |