Nodes/KJNodes for ComfyUI/Image Normalize -1 to 1
ComfyUI Node Runs on cloud

Image Normalize -1 to 1

Rescale an image tensor when something downstream expects -1 to 1

By kijai·Created 3 years ago·Updated about 12 hours ago· 2,930
Image Normalize -1 to 1
  • images
  • IMAGE

ComfyUI's IMAGE tensors live in the [0, 1] range by convention, and almost every node you touch day to day assumes that. But some models, custom encoders, or downstream tools were trained expecting pixel values in [-1, 1] instead - it's a common convention in a lot of vision and generative model code outside ComfyUI's own ecosystem. Feed a [0, 1] image into something expecting [-1, 1] and you don't get an error, you get subtly wrong results - washed-out colors, an offset that looks almost right but isn't. ImageNormalize_Neg1_To_1 exists purely to close that gap: one node, one job, rescale the range.

How it works

It's a linear remap: every pixel value gets scaled from the [0, 1] range it arrived in to [-1, 1]. Concretely that's value * 2 - 1 applied across the whole tensor - 0 becomes -1, 1 becomes 1, and 0.5 (mid-gray) lands at 0. No clamping surprises, no per-channel weirdness, just a straight linear stretch.

The inputs and outputs that matter

  • images - your standard [0, 1] ComfyUI image batch. That's the entire input; there are no options to configure, because there's only one correct way to do this remap.

Output is a single IMAGE, now in [-1, 1] range - wire it directly into whatever node or custom encoder specifically documents that it expects that range.

How to install it

Via ComfyUI Manager: search "KJNodes for ComfyUI," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-KJNodes
pip install -r ComfyUI-KJNodes/requirements.txt

then restart. Nothing extra required - this is a single arithmetic operation on a tensor.

Common issues & troubleshooting

Your output looks completely blown out after this node. That's almost always a sign the node it's feeding into didn't actually want [-1, 1] input - if a downstream node was already expecting standard [0, 1] and you inserted this node anyway, you've just doubled the range mismatch instead of fixing it. Only use this node when you have a specific, documented reason a particular downstream node or model wants [-1, 1].

You're not sure if the node you're feeding actually needs this. Check that node's own documentation or source first - most of ComfyUI's ecosystem stays in [0, 1] throughout, and this remap is the exception you reach for, not a default step to insert everywhere. Inserting it speculatively is more likely to introduce a bug than fix one.

You need to undo the remap later in the graph. There's no dedicated "inverse" node in this pack for going back from [-1, 1] to [0, 1] - you'd apply the reverse formula (value * 0.5 + 0.5) with a general-purpose math node, or better, only apply this normalization immediately before the node that needs it, so you never have to convert back at all.

CategoryKJNodes/image

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE