Channel Composite Processor

Overview

The Channel Composite processor assembles a new RGBA image by selecting and combining individual channels from one or more existing PNGs—loading all inputs as RGBA—or by using constant values. The resulting composite is always saved as an RGBA PNG.


Example Usage

- processor:
    processor: "channel_composite"
    inputs:
      sky: "mem/sky_color.png" # full-color or single-channel image
      apple: "mem/apple_mask.png" # grayscale mask or color image
    params:
      r: "sky:R" # red channel from 'sky'
      g: "apple:A" # alpha channel from 'apple'
      b: "apple:RGB" # average of red, green, blue from 'apple'
      a: 255 # constant opaque alpha
    outputs:
      target: "mem/skyapple.png" # resulting RGBA composite

Parameters

Key Type Req’d Default Description
r str or int No 0 Source for red channel. See options below.
g str or int No 0 Same options as r, but for green channel.
b str or int No 0 Same options as r, but for blue channel.
a str or int No 255 Same options as r, but for alpha channel. Default is fully opaque.

Options for r:

If the given input key is missing, the processor will raise an error.

Exactly one specification must be provided for each channel; omitted channels use their defaults (R/G/B = 0, A = 255).


Outputs

Key Required Description
target Yes Path to the resulting RGBA image composite

Behavior

Define your channel mapping directly in YAML. Examples:

# use "sky" image's red channel, "apple" image's alpha, average blue/green, constant alpha
params:
  r: "sky" # sky:R implicit default for red
  g: "apple:A" # apple's alpha channel
  b: "apple:GR" # average of apple's green and red channels (order doesn't matter)
  a: "192" # constant alpha (0–255)