Shima Swap Color Mode
Convert images between color spaces (and yes, CMYK is a trap)
- images
- IMAGE
Most of the time you don't think about color spaces, because your images are RGB and everything agrees about that. Then you need a luminance map for a control pass, an HSV version for a color-grade trick, or a YCbCr split for a frequency-separation workflow - and you need a node that can actually convert. Shima SwapColorMode is exactly that: take an IMAGE tensor, pick a target mode, get a converted tensor back. Under the hood it's PIL's .convert() exposed as a node, which means you get every mode PIL knows without reimplementing any color math.
The inputs
images- an IMAGE tensor (single image or batch).color_mode- the dropdown, with nine options:default(pass-through, no conversion),luminance,single_channel,RGB,RGBA,lab,hsv,cmyk, andycbcr. Note the naming:lab,hsv, andycbcrare PIL's mode names, solabis CIELAB andhsvis HSV with a floating-point-style value range.
Output: IMAGE. The node iterates the batch, converts each frame, and re-stacks them.
The modes that matter most
Realistically three of the nine do most of the work. luminance gives you a grayscale version where brightness is all that's left - the standard input for things that want edges or lightness rather than color. single_channel is PIL mode "1", a hard black-and-white threshold (not a smooth gray) - easy to mistake for luminance, and usually not what you want for masks. hsv splits into hue/saturation/value planes for color-grading tricks.
The honest warning: channel counts
This is the trap, and it's a real one. ComfyUI's IMAGE type is assumed to be [B, H, W, 3] RGB by nearly every downstream node. cmyk produces 4 channels, rgba produces 4, single_channel produces 1 - and while this node happily hands those tensors onward, whatever node consumes them next may choke or silently do the wrong thing. lab and hsv stay at 3 channels but their values aren't RGB anymore, so a Preview node will render them as garbage colors even though the numbers are valid. The pattern that actually works: convert, do your channel-specific operation, then convert back to RGB before the next normal node. If you just need a quick grayscale for a mask, luminance is the safe everyday choice.
Installing it
Part of KDB-USJP/shima_wf:
cd ComfyUI/custom_nodes
git clone https://github.com/KDB-USJP/shima_wf
Restart ComfyUI. Pure PIL/torch, no extra dependencies.
The honest take
It's a thin node - genuinely just a color-space conversion wrapper - and it lives in a pack aimed at workflow polish rather than post-processing. If you're already running an image-processing toolkit (WAS, KJNodes, or similar), you likely have an equivalent already and don't need this. But if you're inside the Shima ecosystem and need one clean convert step, it's here, it's simple, and once you remember the RGB-reconstruction pattern it does the job without surprises.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| color_modeopt | COMBO | 9 options: default, luminance, single_channel, RGB, RGBA, lab, +3 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |