Nodes/ComfyUI-TD/ImagetoTD_Tagged
ComfyUI Node

ImagetoTD_Tagged

Send labeled image streams to TouchDesigner for layered compositing

By JiSenHua·Created 2 years ago·Updated 11 days ago· 164
ImagetoTD_Tagged
  • images
    formatpng
    layer_tagdepth
    quality95

    ImagetoTD_Tagged is the advanced sibling of ImagetoTD in the ComfyUI-TD pack, built for one scenario: you're sending multiple image streams into TouchDesigner and you need TD to tell them apart. Plain ImagetoTD just dumps TOPs in; this one attaches a layer_tag to each image, so the ComfyUI2TD.tox component can route streams into separate layers instead of a pile.

    Reach for it when one output isn't enough. Think multi-pass rendering: a depth map on one branch, an RGB render on another, a mask on a third. Give each branch its own tag - "depth", "color", "mask" - and TD can assemble them into a composite or feed them to a shader stack, with each stream landing where you expect it. It's the node that turns a single ComfyUI graph into a multi-texture source for TD's compositing.

    How it works

    The mechanism is a custom packet rather than ComfyUI's stock preview event. Each image is encoded (PNG or JPEG per your format choice), wrapped in a small binary header - magic bytes, a version, a format code, the tag, and the image bytes - and pushed over the WebSocket via a dedicated message type. The tox reads the tag out of that header and uses it to place the image in the right layer. Note that, unlike the other image nodes, there's no broadcast toggle here: tagged packets are always sent to all connected clients.

    The inputs

    An output node - the result lives in TD's layers, not on a socket.

    • images - the IMAGE socket.
    • format - png or jpeg, default png. PNG for fidelity; JPEG when payload size matters, with quality below.
    • layer_tag - the string that labels this stream, default "depth". Give every branch you want separated a distinct tag.
    • quality - 1–100, default 95; only applies to the JPEG format.

    Install

    ComfyUI Manager search ComfyUI-TD, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/JiSenHua/ComfyUI-TD.git
    

    Restart, and install the ComfyUI2TD.tox component from the repo's tox folder (v5.1.x+). Dependencies (trimesh, imageio-ffmpeg, soundfile, plyfile) come along automatically.

    Gotchas

    Two things trip people up. First, the tag is only useful if TD knows what to do with it - you need a tox/preset set up to consume tagged layers, or the tags are just metadata. Second, because there's no broadcast switch, this node is always broadcasting to every connected client; on a shared setup that's surprising, on a single-client setup it's a non-issue. Keep tag strings short and consistent - the header stores them as UTF-8 bytes and the tag length is capped, so long or per-run-random tags will bite you eventually.

    CategoryTouchDesigner

    Inputs (4)

    NameTypeDefaultDescription
    imagesIMAGE
    formatCOMBOpng2 options: png, jpeg
    layer_tagSTRINGdepth
    qualityINT951–100

    Outputs (0)

    No outputs