Change Pixel Value Normalization
The tiny translator between ComfyUI's pixels and the pipeline's
- pixels
- IMAGE
Change Pixel Value Normalization exists because this pack lives in two different mathematical worlds at once, and they disagree about what a pixel value "should" be.
ComfyUI's native IMAGE tensors are floats in the range [0, 1]. That's what Load Image hands you, what VAEEncode expects, and what Preview Image wants back. The diffusers pipeline side of this pack, though, works in [-1, 1] - the range Stable Diffusion was trained in, where 0 is mid-grey. When the pack's diffusers-path nodes take an image, they all do the same internal conversion (pixels * 255 / 127.5 - 1) before feeding the VAE. This node just makes that conversion a first-class citizen of your graph.
What it does
Two inputs, one output, zero surprises:
pixels(IMAGE) - the image to convert.mode-[0,1]=>[-1,1]or[-1,1]=>[0,1].
It returns the converted IMAGE. The [0,1]=>[-1,1] direction is worth looking at closely because it's not a naive x*2-1:
pixels = (pixels * 255).round().clamp(0, 255) / 127.5 - 1.0
It rounds to an 8-bit integer grid first. That round-trips exactly with what the diffusers pipeline does to its own inputs, so you get pixel-identical values instead of a float-math drift. The reverse direction clamps back to [0, 1] after scaling, which is how you get a generated latent back into Preview Image territory.
When you'd actually reach for it
Honestly? Rarely, and that's fine. The most common use is when you're hand-building a diffusers-path workflow and want the image-range conversion to be visible and auditable instead of hidden inside a RUN node - or when you're feeding an image into one of the pack's diffusers nodes that doesn't do the conversion for you and you want to be explicit about the range. It's also handy when you're debugging why a VAE-encoded latent looks wrong: if your input was in the wrong range, the whole try-on silently degrades.
Install
Same as the rest of the pack - ComfyUI Manager, search "comfyui-magic-clothing":
cd ComfyUI/custom_nodes
git clone https://github.com/longgui0318/comfyui-oms-diffusion
# restart ComfyUI
No models, no special dependencies beyond what the pack already needs. The one failure mode worth knowing is not getting the mode backwards: feed a [0,1] image in and pick the [-1,1] mode and you get a clipped mess, not an error. This node is pure math, so it's also the safest node in the pack to trust - no VRAM, no model loads, no attention surgery. It just translates.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | — | |
| mode | COMBO | 2 options: [0,1]=>[-1,1], [-1,1]=>[0,1] |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |