Nodes/ComfyUI-CustomNodePacks/C2C Color Space Convert
ComfyUI Node

C2C Color Space Convert

Move pixels between sRGB, linear, and Log C3 without fighting for a color-management pack

By Code2Collapse·Created 6 months ago·Updated a day ago· 52
C2C Color Space Convert
  • image
  • IMAGE
source_spacesRGB
target_spaceLinear

ComfyUI hands you images as sRGB-encoded tensors in a 0–1 range, and that's fine until you want to composite or grade like a professional. Then you need scene-linear float - because gamma-encoded values treated as linear light blow out every blend. C2CColorSpaceConvert is the bridge: a single node that converts IMAGE between sRGB, Linear, and Log C3. Three spaces, one dropdown each, no OCIO config required.

Where you'll actually use it: linearize an sRGB render before ACES tonemapping or before blending passes (blending in gamma space is how you get dark halos), convert a Log C3 plate from a camera pipeline back to linear for compositing, or encode linear output to Log C3 to hand it to a DaVinci Resolve color session. The KB's post-processing doc calls out exactly this workflow - the "pro-pipeline corner" where people who need it are compositors, not r/StableDiffusion posters - and this node is that corner, distilled.

How it works

The conversion in nodes/hdr_color_science.py is a clean-room implementation of the standard transforms. sRGB↔linear uses the piecewise sRGB transfer curve (the 0.04045/12.92 split, then the 2.4-power curve). Log C3 uses the ARRI LogC3 EI 800 encode/decode constants - the same math that lives in the ARRI SDK, so plates you convert here match what Resolve expects. The pipeline is: convert whatever you have to linear first, then out to the target. If source and target are the same space it short-circuits and returns the input untouched, so you can leave it in a chain without fear.

Inputs and output

  • image - the input batch.
  • source_space - sRGB, Linear, or Log C3. Default sRGB.
  • target_space - same three, default Linear.

Output is a single IMAGE, clamped to 0–1.

Installing it

Part of Code2Collapse/ComfyUI-CustomNodePacks. ComfyUI Manager → search "CustomNodePacks", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git

Restart ComfyUI. Pure tensor math - no models, no extra pip packages. (Don't blanket pip install -r requirements.txt from the pack root over ComfyUI's bundled torch/numpy; install only what you're missing, which for this node is nothing.)

Gotchas

The usual color-science trap applies: converting sRGB→linear on a low-bit-depth image and back is lossy, so do it once, keep your working image linear as long as possible, and encode to display space at the very end. Also, Log C3 here is ARRI's EI 800 variant specifically - if your footage is a different log flavor (S-Log, C-Log, RED Log3G), this node is not that, and you'll get wrong-looking midtones until you convert at the camera's own flavor first. And the output is clamped to 0–1, which is fine for display work but a real limitation if you're trying to carry super-highlights into an HDR composite - for that, keep it linear and don't expect the clamp to save values above 1.0. Keep those three in mind and it's a quietly indispensable utility.

CategoryMEC/Color Science

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
source_spaceCOMBOsRGB3 options: sRGB, Linear, Log C3
target_spaceCOMBOLinear3 options: sRGB, Linear, Log C3

Outputs (1)

NameTypeDescription
IMAGEIMAGE