Color Adjust Processor

Overview

The Color Adjust Processor applies adjustments to the image's overall color properties. It offers control over brightness, contrast, saturation, and hue, allowing fine-tuning of the image appearance. This processor works on the entire image or on a specified area via an optional mask.


Example Usage

- processor:
   processor: "color_adjust"
      inputs:
         source: "input/image.png" # Input image (RGBA)
         mask: "input/mask.png" # (Optional) Grayscale mask to limit the adjustments
      params:
         brightness: 1.0 # Multiplier for brightness (e.g., 1.0 = no change)
         contrast: 1.0 # Multiplier for contrast (e.g., 1.0 = no change)
         saturation: 1.0 # Multiplier for saturation (e.g., 1.0 = no change)
         hue: 0.0 # Hue adjustment in degrees (e.g., 0 = no change)
         gamma: 1.0 # Gamma correction value (e.g., 1.0 = no change)
      outputs:
         target: "output/adjusted.png" # Output PNG image after color adjustments

Inputs

Key Required Description
source Yes Filepath to the input image (RGBA).
mask Filepath to a grayscale mask image to restrict adjustments to specific areas.

Params

Key Type Default Description
brightness float 1.0 Multiplier for brightness. Values greater than 1.0 brighten the image; less than 1.0 darken it.
contrast float 1.0 Multiplier for contrast adjustment. Higher values increase contrast; lower values reduce it.
saturation float 1.0 Multiplier for saturation. Values above 1.0 enhance color intensity; below 1.0 desaturate colors.
hue float 0.0 Hue shift in degrees. Positive or negative values rotate the color wheel.
gamma float 1.0 Gamma correction value. Adjusts luminance non-linearly to improve contrast and detail visibility.

Outputs

Key Required Description
target Yes Filepath to the output PNG image with the applied color adjustments.

Processing Details

  1. Input Loading:

    • Load the source image in RGBA.
    • Optionally load a grayscale mask if provided, to restrict adjustments to specific regions.
  2. Color Adjustment Application:

    • Brightness: Multiply pixel values by the brightness factor.
    • Contrast: Adjust the contrast by scaling the difference of each pixel from the midpoint.
    • Saturation: Modify the saturation by converting to an appropriate color space (e.g., HSL) and scaling the saturation channel.
    • Hue: Shift the hue by rotating the color wheel in the chosen color space.
    • Gamma Correction: Apply gamma adjustment to non-linearly map luminance values.
  3. Mask Handling (Optional):

    • If a mask is provided, limit the adjustments to regions where the mask has non-zero values.
  4. Output Generation:

    • Generate the processed image with the adjustments applied.
    • Save the final image as a PNG in RGBA format to the specified output target.