What's New
Mask Post-Processing Pipeline
Added a research-backed post-processing pipeline for segmentation masks that follows BRIA's official recommendations:
- Min-max alpha normalization — preserves the model's soft alpha matte while using the full 0-255 dynamic range (replaces destructive sigmoid thresholding)
- Morphological opening (erode + dilate) — removes edge noise without permanently shrinking the mask boundary
- Gaussian blur — smooth anti-aliased edges at mask boundaries
Color Decontamination
Added Photoshop-style "Decontaminate Colors" at compositing time:
- Propagates clean foreground RGB into semi-transparent edge pixels
- Eliminates background color fringe (e.g. green/blue spill from colored backgrounds)
- Runs automatically at render time so brush tool edits are always decontaminated
Files Changed
src/lib/maskPostProcessing.ts(new) — post-processing algorithms + color decontaminationsrc/lib/segmentation.ts— integrated mask post-processing intorawImageToCanvas()src/lib/compositing.ts— integrated color decontamination intodrawMaskedForeground()