set it as image type
Stamping 'image' on an any-wire — for when the editor won't take your word for it
- a
- image
An IMAGE in ComfyUI is a tensor - a B, H, W, C batch of pixels - and it's the most common thing to find on a wire in the whole graph. So "set it as image type" is the sibling you'll most often actually need, because images get routed through any-typed junctions constantly: a Use Everywhere node fanning one image out to a VAE Encode, a preview node, and an inpainting branch at the same time.
The problem is the same one every node in this pack exists to fix. Once an image has passed through an any-typed junction, ComfyUI's editor no longer trusts the type on the wire. Feed that into a node with a strict IMAGE input and you can get a refusal at connection time, or worse, a crash at execution when the next node tries to do tensor math on something that isn't one. This node takes the value on a, passes it through untouched, and re-declares it as IMAGE - a "trust me, it's pixels" sticker on the wire.
The mechanism is a two-line pass-through - exec(self, a=None): return (a,) - with RETURN_TYPES = ("IMAGE",) doing all the work. Nothing is converted, resized, or validated. If the thing actually flowing through is a latent or a string, you've just labeled it image and the next node will find out the hard way.
When you'd reach for it
- You've routed one image through a switch or a UE-style any-node and want to feed it into VAE Encode or a Preview Image that's being picky about the socket.
- You're assembling an API-fed graph where an image arrives as
*and a typed consumer insists onIMAGE. - You're mixing several images in a batch-y graph and want the editor's type-safety back without drawing every wire.
If you're not running any-wire routing, you won't need it - plain IMAGE sockets connect to plain IMAGE sockets all by themselves.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/YMC-GitHub/ymc-node-as-x-type
or via ComfyUI Manager (search ymc-node-as-x-type), then restart. No model downloads; the four yors_* pip deps in requirements.txt auto-install on startup. Find it by double-clicking and typing set it as, or right-click → YMC → LINK.
Gotchas
- The label isn't a conversion. Verify what's actually on the other end of
abefore you trust it - a mistaken label crashes downstream, not here. - Single-maintainer, one-commit pack (v0.1.2). Fine for a utility, light on upkeep.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| aopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |