Skip to main content

Image Contrast

Controlled node

Overview

The Image Contrast node adjusts the contrast of an input image. It accepts a Jimp image object and a contrast value, applying the adjustment and returning the modified image. This node is useful for enhancing or reducing the contrast of images as part of image processing workflows.

Inputs

InputTypeDescriptionDefault
RunEventFires when the node starts processing the image.-
ImageDataThe input image to process. Must be a valid Jimp image object.-
ContrastNumberThe contrast adjustment value. Positive values increase contrast, negative values decrease contrast.0

Outputs

OutputTypeDescription
DoneEventFires when the image processing is complete.
OutputDataThe processed image with adjusted contrast (Jimp image object).

Runtime Behavior and Defaults

When the Run event is triggered, the node clones the input image and applies the contrast adjustment using the Jimp library's contrast() method. The contrast value is passed directly to the underlying image processing library.

  • Contrast Range: The contrast value typically ranges from -1 to 1, where:
    • Negative values decrease contrast (making the image flatter)
    • Positive values increase contrast (making the image more stark)
    • A value of 0 leaves the image unchanged
  • Image Handling: The node creates a clone of the input image before processing, leaving the original image data unchanged.
  • Error Handling: If the input is not a valid Jimp image object, the output will be set to null.

Example Usage

Connect an image source (such as a Read Image node or AI Generate Image node) to the Image input. Set the Contrast value to adjust the image appearance:

  • Decrease contrast: Set contrast to -0.5 to create a softer, flatter image
  • Increase contrast: Set contrast to 0.5 to create a more dramatic, high-contrast image
  • Dynamic adjustment: Connect a variable or formula node to the Contrast input to adjust contrast dynamically based on workflow conditions

The processed image can then be passed to other image manipulation nodes (such as Resize Image, Crop Image, or Write To Library) or used directly in subsequent workflow steps.