Identity-Safe Photo Retouching
Use face-identity-lock for all work with people. Start a private job before running this skill. The executable helpers in this bundle only write to the job's drafts subdirectory. Use face-identity-lock deliver or package for finished local files. Keep photographs and photo data local.
Produce a verified edited master. Do not resize, upscale, or package delivery variants in this skill.
Non-negotiable rules
- Work from the highest-resolution source selected by the user and save non-destructively.
- Lock faces, bodies, hands, clothing, pose, accessories, and unrelated geometry by default. Lock hair unless hair is the explicit target.
- Treat a full-frame AI result as identity-approximate, never pixel-identical evidence.
- Use generated output only as replacement material and composite through the smallest viable mask.
- Reject residual objects or shadows, halos, repeated texture, warped perspective, smeared detail, hard mask boundaries, floating hair, or disconnected elements.
- Maintain explicit lineage between source, raw AI candidate, localized composite, and approved edited master.
Select the retouching method
Local object, person, or shadow removal
- Inspect the full-resolution source.
- Generate or construct clean replacement material with matching texture, perspective, lighting, and shadows.
- Resize the candidate to source dimensions and composite only the edited region with
scripts/composite_local_edit.py. - Keep the mask away from protected people and add lock regions for faces and subjects.
- Inspect the full frame and every mask boundary at 100%.
Hair, clothing, or body-adjacent edit
- Trace each generated element from root through its full continuation.
- Prefer a semantic matte for the target material over a broad patch containing skin or background.
- Never blend regenerated skin into an original face merely because it looks similar.
- Stop if reliable segmentation or alignment is unavailable; do not broaden the mask across protected anatomy.
Global color or lighting treatment
- Use deterministic pointwise color grading when geometry and identity must remain unchanged.
- Use reference images for palette direction, not composition transfer.
- State that RGB values intentionally change even though facial structure and geometry remain fixed.
- Do not regenerate a whole photograph only to make it warmer, cooler, brighter, or sunset-like.
Background replacement around people
Use a precise subject segmentation mask. Do not approximate people with rectangles or loose silhouette envelopes. Stop if accurate segmentation is unavailable.
Composite a localized candidate
Create a JSON mask specification with normalized coordinates:
{
"feather_px": 36,
"edit_shapes": [
{"type": "polygon", "points": [[0.08, 0.54], [0.39, 0.53], [0.40, 0.90], [0.08, 0.91]]}
],
"lock_regions": [
{"name": "face", "box": [0.44, 0.30, 0.58, 0.56]},
{"name": "subjects", "box": [0.39, 0.30, 0.62, 1.0]}
]
}
Run:
python scripts/composite_local_edit.py --job "$job" \
--original source.jpg \
--edited ai-candidate.png \
--spec mask.json \
--out "$job/drafts/edited-master.png" \
--mask-out "$job/drafts/edit-mask.png" \
--report-out "$job/drafts/verification.json"
The script fails if the edit mask touches a lock region and verifies protected regions pixel-for-pixel.
Verify the edited master
- Confirm source and output dimensions match.
- Confirm every lock region reports
identical: true. - Inspect edited areas and seams at 100%.
- Trace perspective, horizons, repeating textures, hair, clothing edges, and accessories.
- Reopen the exact exported file and inspect a downscaled full-frame preview.
- Label the method honestly: raw AI preview, localized generated patch plus deterministic compositing, semantic-matte transfer, or pointwise color grading.
Do not approve a known-bad draft. Hand the approved edited master to a separate upscaling or delivery skill only when the user requests those stages.