I used vibe coding to build a simple test for Mattifier. The forehead and nose should get less shiny without pulling the nearby cheek down with them. I ran the real Photoshot engine and a uniform skin-darkening comparison on the same synthetic input.

1. Estimate nearby skin lightness

Mattifier converts sRGB to Lab and reads L*. A skin-weighted Gaussian average gives it a local estimate of diffuse lightness. The common engine passes the working RGB image, the skin mask and analysis scale to the tool.

2. Reduce the bright residual

The tool compares a narrow blur with the broader estimate. It subtracts a small threshold, caps the positive residual and scales the candidate with blend, which defaults to 0.5. A separate brightness gate runs from L* 51 to 78 and combines with the skin mask. OpenCV supplies the Lab conversion and Gaussian blur. NumPy supplies the weighted array operations and clipping.

3. Return an editable layer

The common engine filters negligible differences and returns a Normal RGB patch with coordinates and an 8-bit mask. The lab rebuilds the image from the saved assets. The 16-bit RGBA replay of layers and merged output agreed at final integer precision and preserved the two nonopaque test pixels.

4. Compare the same regions

At 0.5, Mattifier reduced mean L* by 5.13 on the forehead and 5.83 on the nose. The measured cheek and background stayed unchanged. A uniform skin pass came within about 0.10 L* of the forehead reduction and lowered the cheek by 5.22. A gentle, shine-free gradient returned no layer. A painted bright mark inside the skin mask was darkened, showing where the local brightness heuristic can mistake pale color for shine.

On the NASA portrait, 0 strength emitted a one-pixel mask in layers mode. The final 8-bit pixels were unchanged and merged mode returned no layer. The full article and lab include the two implementations, fixed inputs, expected masks and measurements. Photoshop PSD and Undo checks belong to the editor integration.

Read Part 6 and download the lab · Part 5

Retouch4me examples · OpenCV source · NumPy source