Vibe coding gets easier to check once you can predict which pixels the engine will change. Part 4 of Photoshot Retouch follows a photo from input through the correction loop to the layers returned to the editor.
Define the input
The engine receives interleaved RGB or RGBA at 8 or 16 bits per channel. The Photoshop adapter requests sRGB and full-range samples. The Python engine expects those sample values and carries the sRGB profile in the result manifest. For RGBA, the correction mask is zero wherever source alpha is below full opacity.
Analyze and apply the correction
The shared analysis fits the long edge to 1,400 pixels at most. OpenCV resizes the candidate-minus-input difference and mask back to source size. Eye Vessels, Eye Brilliance, Fabric, Stray Hairs and Glasses Glare compute their correction at source resolution. NumPy handles the typed arrays and rounding. With an 8-bit source value of 80 and patch value of 120, mask weights 0, 0.5 and 1 reconstruct to 80, 100 and 120. The middle mask is stored as byte 128.
Return a replayable layer
Each cropped patch carries source coordinates, RGB at the request's depth and one 8-bit mask byte per pixel. OpenCV finds the rectangle. The versioned result also records Normal mode and visibility. Layered output keeps each applied correction. Merged output records the final changed pixels in one correction. The Skin Mask can be returned as a hidden utility in either mode.
Check the result
The four 8- and 16-bit RGB/RGBA fixtures reconstructed from layered and merged files with zero difference at final integer precision. The local API returned 12 layers after a 14-tool request and passed a separate 16-bit RGBA Dust check. The repository's 127 Python tests passed. Photoshop PSD save, reopen and Undo remain editor-specific checks.
Top comments (0)