Nodes/ComfyUI-Apt_Preset/stack_Mask2color
ComfyUI Node

stack_Mask2color

Recolor Up to Three Masks for Visualization

By cardenluo·Created 2 years ago·Updated 17 days ago· 309
stack_Mask2color
    • mask_info
    mask_mode1原始
    fill1true
    mask1_colorDefault
    outline_thickness13
    mask_mode2原始
    fill2true
    mask2_colorDefault
    outline_thickness23
    mask_mode3原始
    fill3true
    outline_thickness33
    mask3_colorDefault

    If you've worked with segmentation masks - face, clothes, body regions, whatever a preprocessor spat out - you know a raw grayscale mask is nearly useless to look at. stack_Mask2color doesn't segment anything itself; it defines up to three colored visualization styles that a downstream node applies to real masks, so when you're debugging a multi-mask workflow you can actually tell which mask is which at a glance instead of squinting at three overlapping white blobs.

    How it works. Notice there's no mask input on this node at all - it's a pure config, same pattern you'll see on a few other nodes in this pack (Stack_pre_Mark2, Stack_ShadowAndGlow). You set up to three independent "slots," each with its own mask_modeN (how the mask's shape gets rendered - as its original outline, or forced into a square, circle, five-pointed star, diamond, or hexagon), a fillN toggle (solid fill vs. outline only), a mask{N}_color from a small fixed palette, and an outline_thicknessN for when you're drawing borders instead of fills. The output, mask_info, bundles those three style definitions and hands them to whatever node in the pack actually paints them onto your real masks.

    Where you'd use it. Anywhere you've got multiple masks in flight and need to eyeball them without opening each one separately - checking a face/clothes/body segmentation pass before you commit to inpainting each region, or sanity-checking a multi-character mask setup before a batch run. The geometric-shape modes (circle, star, diamond, hexagon) are for cases where you don't actually want the mask's real silhouette drawn, just a marker at roughly where it is - useful for a quick "did the detector even find something here" check rather than a pixel-accurate preview.

    One thing to flag before you install it: the mask_mode dropdown options ship in Chinese in this build - 原始 (original), 方形 (square), 圆形 (circle), 五角星 (five-pointed star), 菱形 (diamond), 六边形 (hexagon). The color options (Red, Green, Default, etc.) are in English, so it's an inconsistent, half-translated menu rather than a fully localized one. Nothing wrong functionally, just don't be surprised the first time you open that dropdown and don't recognize a word.

    Installing it. Same as the rest of the pack: git clone https://github.com/cardenluo/ComfyUI-Apt_Preset into custom_nodes, restart ComfyUI, or search "ComfyUI-Apt_Preset" in ComfyUI Manager. On Windows, run the bundled install.bat once after cloning - the README calls this out as the way to pull in the pack's Python dependencies, and some of the pack's segmentation-adjacent features (not this node specifically) need the resource pack the README calls Apt_File, downloaded separately and dropped into ComfyUI/models/Apt_File.

    Troubleshooting. If nothing visibly changes downstream after wiring this in, check that the consuming node is actually reading mask_info - this node produces nothing visual on its own, it's purely a style definition, so a missing connection downstream will silently no-op rather than error. If a mask_mode's geometric shape looks wrong or off-center, remember it's replacing the mask's real shape entirely, not just recoloring it - that's by design, not a bug, and if you wanted the true silhouette you want 原始/"original" mode instead. And if a color picks the wrong thing entirely, double-check you're not confusing slot 1/2/3 - each is fully independent, and it's easy to set colors on the wrong slot when three near-identical parameter groups sit stacked on the same node.

    CategoryApt_Preset/stack/😺backup

    Inputs (12)

    NameTypeDefaultDescription
    mask_mode1COMBO原始6 options: 原始, 方形, 圆形, 五角星, 菱形, 六边形
    fill1BOOLEANtrue
    mask1_colorCOMBODefault10 options: Default, Red, Green, Blue, Yellow, Magenta, +4
    outline_thickness1INT31–50
    mask_mode2COMBO原始6 options: 原始, 方形, 圆形, 五角星, 菱形, 六边形
    fill2BOOLEANtrue
    mask2_colorCOMBODefault10 options: Default, Red, Green, Blue, Yellow, Magenta, +4
    outline_thickness2INT31–50
    mask_mode3COMBO原始6 options: 原始, 方形, 圆形, 五角星, 菱形, 六边形
    fill3BOOLEANtrue
    outline_thickness3INT31–50
    mask3_colorCOMBODefault10 options: Default, Red, Green, Blue, Yellow, Magenta, +4

    Outputs (1)

    NameTypeDescription
    mask_infoMASK_INFO