KJNodes/imagegenerated

Image Normalize -1 to 1(ImageNormalize_Neg1_To_1)

This node technically performs a simple linear transformation: multiplying each pixel value of the input by 2.

Image Normalize Neg1 To 1

images
IMAGE
KJNodes

The Image Normalize -1 to 1 node is a tool for image data preprocessing. Its core function is to linearly transform the input image pixel value range from [0, 1] to the interval [-1, 1]. This operation is a standard input requirement for many deep learning models, particularly Generative Adversarial Networks (GANs).

Node Function

Technically, this node performs a simple linear transformation: it multiplies each pixel value of the input by 2.0 and then subtracts 1.0. It accepts input in the standard ComfyUI IMAGE tensor format, which is typically a floating-point tensor with a shape of [batch, height, width, channels], and outputs a tensor of the same shape. This process does not change the image resolution or the number of channels; it only normalizes the numerical range.

Node Parameter Description - Image Normalize -1 to 1

Inputs

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
imagesIMAGEYes---

Outputs

Parameter NameData TypeDescription
IMAGEIMAGE-

Usage Scenarios

For example, in workflows such as Stable Diffusion or ControlNet, when there is a need to convert externally loaded image data with a pixel value range of [0, 1] to the [-1, 1] range required for internal model processing, this node can be used. It is typically connected after an image loading node and before a model input node, serving as a standardization step in the data pipeline.

Notes

Please note that this node assumes the original value range of the input image is already within [0, 1]. If the input is an image with an unprocessed integer range of 0-255 or another range, using this node directly will result in incorrect normalization. Appropriate scaling must be performed first.

The Image Normalize -1 to 1 node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…