Shadow Processor

Overview

The Polygonal Shadow Processor (shadow) generates a drop shadow beneath a subject based on a mask or alpha channel. It works entirely in 2D using geometric analysis.


Example Usage

- processor:
    processor: "shadow"
    inputs:
      source: "input/input.png"
      mask: "input/mask.png" # Optional; defaults to source alpha
    params:
      color: "rgba(0, 0, 0, 0.9)"
      blur_radius: 15.0
    assigns:
      left: "shadow_left"
      top: "shadow_top"
      width: "shadow_width"
      height: "shadow_height"
      right: "shadow_right"
      bottom: "shadow_bottom"
    outputs:
      composite: "out/shadowed.png"
      shadow: "out/shadow_only.png"
      shadowed: "out/subject_with_shadow.png"
      annotated: "out/debug_overlay.png"

Inputs

Key Required Description
source Yes RGBA image used as the background and subject
mask No Grayscale image defining the subject; defaults to source alpha if omitted

Params

Key Type Default Description
color string "rgba(0, 0, 0, 0.9)" Shadow color and max opacity
blur_radius float 15.0 Gaussian blur radius for softening the shadow edges

Outputs

All outputs are optional. Set the ones you want in your YAML.

Output Key Description
composite Shadow + subject composited into the original source image (RGBA)
shadow Shadow-only layer with subject removed (RGBA, transparent background)
shadowed Subject over shadow on a transparent background (no original background)
annotated Composite image with debug lines showing the shadow polygon and cut lines

Assigns

The processor also computes and assigns the shadow bounding box:

Assign Key Meaning
left X-coordinate of left edge of shadow
top Y-coordinate of top edge of shadow
width Width of shadow region
height Height of shadow region
right Right edge (left + width)
bottom Bottom edge (top + height)