xxg-portrait-rebuild-light
"Edit an existing JPG, JPEG, PNG, or WebP portrait to rebuild physically coherent light, exposure, color, capture style, clean optical skin, and frame quality without changing the person. Use for plastic-skin or AI-look removal, dirty synthetic texture, banding, edit seams, color drift, multi-round quality loss, tone or white-balance correction, camera/film/device emulation, backlight, prism, blind shadows, candlelight, neon, golden hour, rim light, rain-wet low key, studio light, or silhouettes."
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/moskoo--xxg-portrait-rebuild-light)HTML
<a href="/listings/moskoo--xxg-portrait-rebuild-light"><img src="/api/listings/moskoo--xxg-portrait-rebuild-light/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
Personal skill:
mkdir -p ~/.codex/skills cp -R ./xxg-portrait-rebuild-light ~/.codex/skills/
Shared Agent Skills directory:
mkdir -p ~/.agents/skills cp -R ./xxg-portrait-rebuild-light ~/.agents/skills/
For a project-level install, place it in `.agents/skills/` at the project root. Invoke it explicitly with `$xxg-portrait-rebuild-light`.
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 177 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- ---
- name: xxg-portrait-rebuild-light
- description: "Edit an existing JPG, JPEG, PNG, or WebP portrait to rebuild physically coherent light, exposure, color, capture style, clean optical skin, and frame quality without changing the person. Use for plastic-skin or AI-look removal, dirty synthetic texture, banding, edit seams, color drift, multi-round quality loss, tone or white-balance correction, camera/film/device emulation, backlight, prism, blind shadows, candlelight, neon, golden hour, rim light, rain-wet low key, studio light, or silhouettes."
- ---
- # XXG Portrait Rebuild Light V2.3
- ## Objective
- Treat the input as the same photograph, never as a reference for a replacement portrait. Improve illumination, exposure, color rendering, capture character, skin response, and generation quality while retaining identity, facial geometry and natural asymmetry, expression, pose, camera view, framing, and subject scale. Preserve source optics unless the user explicitly requests an optical restyle.
- Build realism from three separable signals:
- 1. clean low-frequency skin tone and broad transitions;
- 2. source-driven diffuse/specular response with highlights confined to plausible light-facing areas;
- 3. fine, region-specific microdetail limited by face scale, focus, and illumination.
- Do not manufacture realism with dirt, darkness, coarse pores, uniform grain, random color patches, or exaggerated facial lines. The result must first read as a clean photograph at normal size.
- ## Choose the Edit Scope
- - **`texture-only`**: when the user asks only to remove plastic/AI skin or recover detail, force `L0 + E0 + T0 + G0 + D0 + A0 + Q0`. Preserve the source lighting, highlight placement, exposure, white balance, focal plane, depth of field, and background.
- - **`tone-and-exposure`**: when the user asks for brightness, highlight/shadow recovery, white balance, palette, or grading without new lighting, preserve the source light direction and edit only E/T/G.
- - **`relight-and-skin`**: when the user requests a lighting change or selects L/T/A, authorize the requested light response while preserving source focal plane and depth of field unless explicitly changed.
- - **`capture-style`**: when the user requests a camera, film, phone, CCD, or era look, edit G/D and only the exposure behavior logically required by that capture; preserve viewpoint, crop, focal plane, and depth of field.
- - **`optical-restyle`**: only when the user explicitly requests a different focal-length perspective, camera angle, aperture behavior, or depth of field. State that axis once and permit only the minimum framing/background reconstruction it requires.
- - **`quality-repair`**: when the user asks to remove dirty synthetic patterns, banding, posterization, seams, halos, or other generation residue, edit only Q and preserve light, color, structure, optics, and natural texture.
- - **`base-color-repair`**: when an edited result has an unintended cast, use the original root base to restore only unchanged or unauthorized color relationships; preserve deliberate recolors and requested E/T/G/A changes.
- - **`multi-round-repair`**: when repeated edits accumulate tint, noise, sharpening, compression, banding, or seams, use the latest accepted edit as the target and the first root base as the stable identity/geometry/color reference.
- Never let texture repair become relighting, tone correction become a new light source, device emulation become a new pose/viewpoint, or quality cleanup become global smoothing or an unauthorized regrade.
- ## Use the Host Image Editor
- 1. Inspect the source and read the host's native image-generation or image-editing skill.
- 2. Discover the actual callable in the tool registry. In Codex, inspect `ALL_TOOLS` and prefer the exact discovered name `image_gen__imagegen`.
- 3. For a local source in Codex, use the discovered tool and its real arguments:
- ```js
- const result = await tools.image_gen__imagegen({
- referenced_image_paths: ["/absolute/path/source.png"],
- prompt: "compact English image-edit prompt"
- });
- generatedImage(result);
- ```
- Never guess `tools.image_gen` or `input_image`. Correct wrong members, arguments, or `TypeError` from the registered signature and retry. In Claude, OpenClaw, or another host, use the equivalent native image-edit action explicitly exposed by that host.
- For base-anchored or multi-round repair, pass exactly `[CURRENT_EDIT, ROOT_BASE]` and state: Image 1 is the edit target; Image 2 is the original root reference for declared locked axes only. Do not attach every intermediate round.
- ## Route the Outcome
- | Observed state | Required action |
- | --- | --- |
- | Compatible image tool discovered | Invoke it. A small face, dense text, complex props, or edge contact lowers detail ambition but never blocks generation. |
- | Correct image tool returns a real error | Report the actual error, enter `prompt-only`, and return a complete compact prompt. |
- | Discovery completes with no compatible callable | Enter `invocation-handoff` and return a complete compact prompt. |
- | Result is nearly unchanged, changes identity, creates artificial skin, or misses the light | State that the result did not achieve the requested improvement, enter `prompt-handoff`, and recompile from the source. |
- Reading a skill, inspecting an image, creating a task, or announcing generation is not an image-tool invocation.
- ## Never Produce the Final Image Locally
- Do not use Pillow, NumPy, OpenCV, ImageMagick, FFmpeg, `sips`, or custom raster scripts to relight, grade, retouch, sharpen, add texture, resize, crop, extend, composite, repair, or produce the delivered image. Use them only for read-only aspect-ratio, mask, and result audits. See `requirements.txt`.
- ## Compile the Image Prompt
- Read [the V2.3 prompt compiler](references/prompt-recipes.md), [the lighting and skin recipes](references/lighting-skin-color-temperature-recipes.md), [the tone/exposure/style/device recipes](references/tone-exposure-style-device-recipes.md), and [the quality/iteration recipes](references/quality-repair-and-iteration.md). Decide internally as:
- ```text
- Scope → Key L → Exposure E → Fill/Shadow → Skin scale S → Skin finish P → Light color T → Look G → Capture D → Background/Atmosphere A → Quality Q
- ```
- Select exactly:
- ```text
- one L + one E + one S + one P + one T + one G + one D + zero or one A + one Q
- ```
- Use one key-light system. Atmosphere and skin reflections must inherit its direction, size, falloff, and color. E controls exposure, G controls palette/curve, and D controls capture response; none may invent another light. `A6` is the sole override: force E6 silhouette exposure, remove all subject fill/catchlights/internal illumination, use L/T only for the rear source and background, and suppress S/P. Q may clean the background but must never restore detail inside the silhouette.
- Send four core lines, adding RENDER for a requested grade/device response and QUALITY for an observed repair target:
- ```text
- EDIT: scope, identity/structure lock, and source-optics lock.
- LIGHT: one L, one E, physical shadow/background response, T, and optional A.
- RENDER: one G plus one D, only when either differs from source.
- SKIN: one scale-aware S behavior plus one source-consistent P finish.
- QUALITY: one Q repair, only when Q differs from source.
- AVOID: only the two or three failures most likely for this source.
- ```
- - Use four lines when `G0 + D0 + Q0`; add RENDER only for a requested grade/device and QUALITY only for an observed repair target. Target `55–110` English words, with an absolute ceiling of `135` for combined edits.
- - State identity once. Treat the source itself as the identity card; do not invent a new age, personality, beauty description, lens, or aperture.
- - Use positive, observable photographic behavior before negative constraints. Omit recipe codes, audits, confidence, backend notes, and reasoning.
- - Compile bare words such as `cinematic`, `editorial`, `HDR`, `film`, `DSLR`, `medium format`, or `smartphone` into visible exposure, palette, tonal, microcontrast, sharpening, and dynamic-range behavior.
- - Default to `E0 + G0 + D0 + Q0`. Never mix multiple device profiles, color looks, or quality recipes. Never claim exact manufacturer color science or pixel identity from prompt wording.
- - Keep default prompts free of realism-by-dirt terms: freckles, blemishes, blackheads, rough skin, color irregularity, film grain, gritty texture, under-eye lines, and high contrast. Preserve source-specific marks without naming or amplifying them.
- - Use `deep`, `near-black`, or `hard contrast` only when the user explicitly selects backlight, hard light, low-key, neon, or silhouette behavior.
- - On retry, replace the failed line instead of appending more instructions.
- Every handoff must use this structure with no placeholders.
- ## Preserve the Identity Signature
- Keep six source-defined groups stable: face outline/proportions; feature spacing, shape, and size; hairline, parting, and hair mass; source-identifying skin anchors; makeup/accessories; and apparent age/expression. Do not describe these groups in detail to the image model unless a real failure requires a shorter identity retry. Detailed identity checks belong in validation, not the generation prompt.
- Under A6, internal features are intentionally hidden. Judge identity from hair/head/body outline, head-to-body ratio, pose, position, and framing.
- ## Apply Optical Skin Realism
- - Keep overall skin color clean and continuous across face, ear, neck, and visible upper chest. Local transitions should be gentle and source-consistent, never patch-like.
- - Use a diffuse base with small bounded specular highlights only on planes facing the selected key. Avoid a whole-face gloss layer and avoid removing all highlights.
- - Vary surface detail by region: cheek pores softer, nose pores slightly clearer, lip texture separate, eye-area structure undisturbed. Do not tile one pore pattern across the face.
- - Match detail to the source focus plane, depth of field, face size, and illumination. Never sharpen the whole face, every hair, clothing, and background equally.
- - Preserve source-existing marks as identity anchors, but do not list or generate new imperfections by default.
- - Preserve source skin tone; do not use `fair`, `whiter`, or beauty-grade language unless the user explicitly requests a complexion change.
- ## Apply Physical Light Without Unwanted Darkness
- - Default preservation to E0 and natural relighting to E1, with clean midtones and readable but directional shadow separation.
- - Add fill only when the selected exposure requires information to remain readable. Do not flatten intended backlight, hard light, low-key, or silhouette.
- - Derive shadow edge from apparent source size and distance. Carry direction, falloff, cast shadows, and reflected color across subject, clothing, nearby surfaces, and background.
- - Keep window/tree shadows continuous across curvature and adjacent surfaces; keep bokeh only in optically defocused regions; require a visible or strongly inferred source for rays; give neon a clear primary and secondary source.
- - Treat prism color as refraction of one existing source, not painted rainbow patches. Give blind/lattice shadows one projection geometry, candlelight rapid near-field falloff, rim light a continuous rear-quarter outline, and rain-wet highlights the same direction as the key.
- - Under A6, render the complete subject interior as one clean black mass. Permit only a narrow source-consistent rim that does not enter the silhouette.
- ## Apply Tone and Capture Style Precisely
- - Separate scene light from image rendering. L/T define the physical source; E places highlights, midtones, shadows, and black point; G defines palette and curve; D defines capture response.
- - For exposure changes, name all four tonal zones. Do not request simultaneous global highlight recovery and shadow lifting; preserve directional contrast.
- - For color/style changes, state skin-neutral placement, neutral-object behavior, saturation relationship, contrast curve, and highlight roll-off. A tint alone is not a style.
- - Translate device names into visible behavior. Full-frame, medium-format, 35mm negative, CCD compact, point-and-shoot flash, smartphone computational, instant film, and disposable-camera profiles live in the device reference.
- - Device emulation preserves camera position, perspective, crop, focal plane, and depth-of-field strength unless `optical-restyle` is explicit. If optics change, state the visible consequence rather than lens numbers alone.
- - Grain, vignetting, borders, color casts, exposure defects, and date stamps are opt-in analog artifacts. They are frame-level effects and never create skin realism.
- ## Repair AI Generation Quality Without Flattening Detail
- - Read [the V2.3 quality reference](references/quality-repair-and-iteration.md) for dirty synthetic patterns, gradient banding, edit seams, color drift, or cumulative multi-round degradation.
- - Distinguish synthetic repeating residue from real pores, hair, fibers, weave, film grain, edges, and focus falloff. Remove only the observed defect; never apply generic denoising or whole-frame smoothing.
- - Treat banding as broken luminance/chroma continuity, not as a shadow to lift. Preserve real object edges, cast-shadow boundaries, local contrast, and black point.
- - For local seams, separate the target, its legitimate interaction pixels, and protected surroundings. Match boundary light, color, sharpness, depth, noise, haze, and reflections without blurring the whole region.
- - For color drift, use the first root base—not the previous round—as the color reference. Lock only unchanged or unauthorized regions; never undo an intentional relight, grade, monochrome conversion, or recolor.
- - For repeated edits, use the current accepted edit as Image 1 and the root base as Image 2. Repair after every round before continuing, and do not attach the full history.
- - Prompt constraints reduce regeneration but cannot hard-lock pixels. Never use local Pillow/NumPy/OpenCV filters to produce the final image or claim deterministic preservation.
- ## Preserve the Frame
- Retain orientation, aspect ratio, composition, focal plane, depth of field, and subject-to-frame scale. A backend may downscale uniformly; exact pixel dimensions are not required. If a local result exists, run the read-only check:
- ```bash
- python3 "$XXG_SKILL_DIR/scripts/check_aspect_ratio.py" SOURCE_IMAGE EDITED_IMAGE
- ```
- Accept relative aspect-ratio drift of `≤5%`. Never resize, crop, pad, or extend locally to force a pass.
- ## Validate the Result
- After generation, read [the V2.3 identity and detail audit](references/identity-and-detail-audit.md). At normal size first, verify:
- 1. the requested lighting/tone/capture change—or exact preservation of every unauthorized axis—is immediately clear;
- 2. identity signature, pose, source optics, framing, and subject scale remain stable;
- 3. skin reads clean before microdetail becomes visible, with bounded highlights and no uniform gloss or texture overlay;
- 4. detail density follows facial region, focus, scale, and illumination rather than appearing equally sharp everywhere;
- 5. subject and environment share one physical light system; exposure, grade, and capture response are coherent; A6 remains a complete black interior.
- 6. the selected Q repair is visible without erased natural detail, unintended color rollback, new seams, or later-round quality loss.
- If a result is nearly unchanged, strengthen one observable target. If skin becomes artificial, replace SKIN with `clean continuous source skin tone; bounded source-shaped highlights; faint region-specific microdetail only where focus and light resolve it`. Never present a failed image as final.
- ## Load References Only When Needed
- - For every prompt: `references/prompt-recipes.md` and `references/lighting-skin-color-temperature-recipes.md`
- - For tone, exposure, grading, style, device, film, camera, phone, CCD, or optics requests: `references/tone-exposure-style-device-recipes.md`
- - For dirty texture, banding, posterization, seams, color drift, or repeated-edit degradation: `references/quality-repair-and-iteration.md`
- - For tool routing, backend classification, or failure handling: `references/backend-and-clean-realism.md`
- - After generation: `references/identity-and-detail-audit.md`
- - Only for a verified strict local-edit backend: `references/edit-plan-and-protection.md`
README.md · README · 417 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- <div align="center">
- <img src="assets/skill-icon.png" width="120" alt="xxg-portrait-rebuild-light skill-logo">
- </div>
- <h1 align="center">XXG Portrait Rebuild Light</h1>
- <p align="center">
- <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-red?style=flat-square" alt="MIT License"></a>
- <a href=""><img src="https://img.shields.io/badge/Python-3.10+-blue.svg?style=flat-square" alt="Python"></a>
- <a href=""><img src="https://img.shields.io/badge/CodeX-Skill-green.svg?style=flat-square" alt="codex"></a>
- <a href=""><img src="https://img.shields.io/badge/Claude-Skill-yellow.svg?style=flat-square" alt="Claude"></a>
- <a href=""><img src="https://img.shields.io/badge/Open-Claw-8A2BE2.svg?style=flat-square" alt="OpenClaw"></a>
- <a href="CHANGELOG.md"><img src="https://img.shields.io/badge/Version-2.3.0-black?style=flat-square" alt="Version 2.3.0"></a>
- </p>
- English | [简体中文](README.zh-CN.md) | [日本語](README.ja.md) | [한국어](README.ko.md)
- `xxg-portrait-rebuild-light` is an image-edit skill for existing portraits. V2.3 separately controls physical light, exposure placement, color/style grade, capture-device response, broad skin tone, bounded reflection, scale/focus-aware microdetail, and AI-generation quality repair.
- The skill changes the lighting without redrawing the person. It preserves identity, facial structure and proportions, natural slight asymmetry, expression, pose, camera view, and composition. It avoids plastic skin, grainy skin, dirty color variation, and fake depth made by exaggerating wrinkles.
- 
- ## Key features
- - Provides `texture-only` fidelity recovery without changing source lighting, color, focus, depth of field, or scene content.
- - Repairs plastic smoothness by separating clean broad tone, source-shaped highlights, and scale/focus-aware regional microdetail.
- - Adds seven skin-finish profiles (`P0–P6`) for source-matched, satin-matte, soft-daylight, editorial, direct-flash, beauty, and available-light response.
- - Adds `E0–E7` exposure recipes that explicitly place highlight headroom, facial midtones, directional shadows, and black point.
- - Adds `G0–G8` color/style grades and `D0–D8` capture profiles for full-frame digital, medium format, 35mm negative, CCD compact, point-and-shoot flash, smartphone, instant film, and disposable-camera response.
- - Separates device response from optics: camera-style edits preserve viewpoint, perspective, crop, focal plane, and depth of field unless optical restyle is explicitly requested.
- - Repairs weak backlighting, disconnected indoor window light, flat lighting, unintended crushed shadows, and highlights with no physical source.
- - Supports soft window light, commercial soft light, Rembrandt lighting, cinematic low-key lighting, golden hour, dual-color neon, and diagonal hard light.
- - Adds at most one physically coherent atmosphere effect, including prism refraction, blind/lattice shadow lines, rain-wet reflections, window/tree shadow, bokeh, sunset flare, volumetric light, or a full-black silhouette.
- - Adds dedicated candle/flame and rim-led portrait keys with realistic falloff, edge placement, and restrained fill.
- - Adds `Q0–Q6` quality recipes for synthetic dirt/grid patterns, banding, edit seams, color drift, and cumulative multi-round degradation.
- - Uses the first root base—not the previous edit round—as the stable color/identity reference, while retaining intentional new colors and authorized lighting or grading.
- - Repairs only observed artifacts and preserves pores, hair, directional fibers, fabric weave, edges, shadow boundaries, and source focus falloff.
- - Controls subject and background in layers: key light and exposure intent first, then fill, shadows, ambient light, and color temperature.
- - Preserves identity, facial feature size and position, expression, pose, wardrobe, background structure, and source framing.
- - Reduces the skin-detail target automatically when the face is small, without canceling the requested lighting change.
- - Uses the current agent's own image-generation or image-editing capability by default; no separate API is required.
- - If the current agent has no image-edit capability, or the edit misses the target, returns one complete compact image-edit prompt.
- - Never uses Pillow, NumPy, OpenCV, ImageMagick, or temporary filter scripts to produce the delivered image.
- 
- 
- 
- 
- ## Core method
- The skill first makes a director-style lighting decision internally:
- ```text
- Scope → Key L → Exposure E → Fill/Shadow → Skin S/P → Light color T → Look G → Capture D → Atmosphere A → Quality Q
- ```
- The prompt sent to the image model uses four compact core lines, adding `RENDER` only for a requested grade/device response and `QUALITY` only for an observed repair target. Target length is 55–110 English words:
- ```text
- EDIT: Choose the smallest authorized scope; retain source identity, geometry, pose, camera view, optics, framing, and every unauthorized axis.
- LIGHT: One L and E with explicit highlight, midtone, shadow, black-point, background, T, and optional A behavior.
- RENDER: One G palette/curve plus one D capture response. Omit for G0 + D0.
- SKIN: One scale-aware S plus one light-consistent P finish.
- QUALITY: One observed Q repair; omit for Q0.
- AVOID: Only two or three source-specific failures.
- ```
- The skill does not pile identity audits, object inventories, repeated negatives, and several photographic styles into one prompt. That often causes constraints to cancel each other or produces an unchanged copy.
- For skin-only requests, V2.3 forces `L0 + E0 + T0 + G0 + D0 + A0 + Q0`. Tone correction changes only E/T/G; capture-style changes only G/D and a logically required E; relighting changes L/E/T/A; quality repair changes only Q. Viewpoint, perspective, crop, focal plane, and depth of field stay source-matched unless the user explicitly requests `optical-restyle`.
- `A6` forces E6 silhouette exposure, moves the effective light behind the person, removes all fill and catchlights, and renders the subject interior black. L/T and any G/D treatment affect only the rear source and background; S/P are suppressed.
- ## Recipes
- Choose only:
- ```text
- one L light + one E exposure + one S skin scale + one P skin finish + one T light color + one G color/style grade + one D capture response + zero or one A atmosphere + one Q quality repair
- ```
- ### Lighting L
- | Code | Purpose |
- | --- | --- |
- | `L0` | Match the source; repair only flat light, unexplained crushed shadows, abnormal highlights, and harsh transitions |
- | `L1` | Natural backlight, highlight-priority by default; add fill only when explicitly requested |
- | `L2` | Soft natural window light |
- | `L3` | Large commercial soft light |
- | `L4` | Outdoor skylight |
- | `L5` | Indoor practical and mixed lighting |
- | `L6` | Hard single-point light or direct sunlight |
- | `L7` | Low-key diagonal narrow light beam |
- | `L8` | Classic editorial Rembrandt lighting |
- | `L9` | Cinematic low-key warm key / cool ambient light |
- | `L10` | Golden-hour sunset side backlight |
- | `L11` | Cyberpunk cyan/magenta dual-tone neon |
- | `L12` | Clean, even commercial soft light |
- | `L13` | Candle or flame near-field key with rapid falloff |
- | `L14` | Rim-led dramatic portrait light with restrained frontal fill |
- ### Exposure E
- | Code | Purpose |
- | --- | --- |
- | `E0` | Preserve source highlights, midtones, shadows, and black point |
- | `E1` | Balanced natural exposure with clear midtones and directional shadows |
- | `E2` | Protect a bright source/rim and let unlit planes follow available bounce |
- | `E3` | Recover only blocked shadow information while controlling bright sources |
- | `E4` | High-key exposure with textured whites and gentle facial modeling |
- | `E5` | Low-key exposure with selected lit planes and a clean black point |
- | `E6` | Full silhouette exposure; use only with `A6` |
- | `E7` | Direct-flash subject exposure with rapid ambient falloff |
- ### Skin scale S
- | Code | Purpose |
- | --- | --- |
- | `S0` | Small face or wide shot; restore only clean skin tone and natural reflection |
- | `S1` | Default for medium shots; low-contrast microtexture with original lip and eye-area detail |
- | `S2` | High-resolution close-up; region-aware pores, fine vellus hair, and existing details |
- ### Skin finish P
- | Code | Purpose |
- | --- | --- |
- | `P0` | Preserve the exact source diffuse/specular response; default for texture-only edits |
- | `P1` | Natural satin-matte balance with bounded key-facing highlights |
- | `P2` | Soft-daylight luminous midtones and broad highlight roll-off |
- | `P3` | Editorial satin response with controlled T-zone highlights |
- | `P4` | Direct-flash response with compact separated highlights |
- | `P5` | Clean beauty response without porcelain uniformity |
- | `P6` | Available-light response with source focus falloff and no added grain or marks |
- ### Color temperature T
- | Code | Purpose |
- | --- | --- |
- | `T0` | Preserve the source white balance |
- | `T1` | Neutral natural daylight |
- | `T2` | Golden warm light with healthy neutral zones retained in the skin |
- | `T3` | Warm key light with cool background ambience |
- | `T4` | Cyan/magenta neon relationship |
- | `T5` | Cool-neutral overcast or blue-hour light without a full-frame blue wash |
- | `T6` | Warm tungsten practicals with distance-based color falloff |
- | `T7` | Mixed daylight/practical balance with believable skin and neutral objects |
- | `T8` | Candle/flame amber with distance-based warmth and neutral-deep shadows |
- ### Color and style grade G
- | Code | Purpose |
- | --- | --- |
- | `G0` | Preserve the source palette and curve |
- | `G1` | Neutral editorial color with a restrained S-curve |
- | `G2` | Clean commercial color, accurate whites, bright midtones |
- | `G3` | Muted documentary environment with protected skin chroma |
- | `G4` | Warm lit skin with controlled cool background/shadow ambience |
- | `G5` | Pastel editorial midtones and compressed highlights |
- | `G6` | Tonal monochrome with separated skin, hair, clothing, and background |
- | `G7` | Restrained 1970s print response; grain remains opt-in |
- | `G8` | Clean 1990s/Y2K flash color and contrast |
- ### Capture response D
- | Code | Purpose |
- | --- | --- |
- | `D0` | Preserve source capture response |
- | `D1` | Modern full-frame digital: clean detail and smooth highlight roll-off |
- | `D2` | Medium-format digital: smooth tonal steps and restrained sharpening |
- | `D3` | 35mm color negative: gentle highlight compression and softer microcontrast |
- | `D4` | Compact CCD/digicam: direct crisp tone with modest highlight headroom |
- | `D5` | Point-and-shoot direct flash; pair with `L6 + E7` |
- | `D6` | Smartphone computational: broad range without HDR halos or crunchy edges |
- | `D7` | Instant-film tone; border and grain remain opt-in |
- | `D8` | Disposable-camera response; exposure defects and grain remain opt-in |
- ### Atmosphere A
- | Code | Purpose |
- | --- | --- |
- | `A0` | Add no atmosphere effect |
- | `A1` | Soft window shadow |
- | `A2` | Sparse natural tree shadow |
- | `A3` | Soft bokeh restricted to the defocused background |
- | `A4` | Gentle lens flare aligned with the sunset direction |
- | `A5` | Very subtle volumetric light with sparse dust motes |
- | `A6` | Force the entire backlit subject to a clean black silhouette; no face, skin, hair, or clothing detail remains visible inside |
- | `A7` | Prism refraction with a few source-aligned spectral bands or caustic patches |
- | `A8` | Physically projected blind/lattice light-and-shadow lines |
- | `A9` | Rain-wet atmosphere with gravity-consistent droplets and key-shaped reflections |
- ### Quality repair Q
- | Code | Purpose |
- | --- | --- |
- | `Q0` | Preserve current quality behavior; perform no quality repair |
- | `Q1` | Remove only repeating synthetic cellular/maze/grid/chroma residue while preserving natural directional detail |
- | `Q2` | Repair posterization, contour banding, and broken luminance/chroma gradients without blurring real edges |
- | `Q3` | Repair local edit seams, halos, cutout edges, and boundary rendering mismatch |
- | `Q4` | Lock unchanged/unauthorized color relationships to the original root base without undoing intended changes |
- | `Q5` | Consolidate a multi-round edit against the root base and remove accumulated drift, noise, sharpening, compression, banding, and seams |
- | `Q6` | Repair at most three explicitly observed Q1–Q4 defects in one pass |
- ### Extracted lighting presets
- | Effect | Recipe |
- | --- | --- |
- | Prism glow | `L1/L4 + E2 + Sx + P2 + T1 + G1 + D1 + A7` |
- | Blind shadow lines | `L6 + E5 + Sx + P3 + T1/T2 + G1/G4 + D1 + A8` |
- | Candlelit low key | `L13 + E5 + Sx + P6 + T8 + G3/G4 + D1 + A0/A3` |
- | Neon city | `L11 + E5 + Sx + P6 + T4 + G4 + D1 + A3/A9` |
- | Golden twilight | `L10 + E2 + Sx + P2 + T2 + G0/G1 + D0/D1 + A4` |
- | Soft morning window | `L2 + E1 + Sx + P2 + T1/T2 + G0/G1 + D0/D2 + A0/A1` |
- | Rim-led drama | `L14 + E2/E5 + Sx + P3 + T2/T3 + G1/G4 + D1 + A0/A5` |
- | Cool rain-wet low key | `L4/L11 + E5 + Sx + P6 + T5/T4 + G3/G4 + D1 + A9` |
- See [Lighting, skin, color-temperature, and atmosphere recipes](references/lighting-skin-color-temperature-recipes.md) for detailed prompt clauses.
- ## Image capabilities by agent
- | Agent | Default route |
- | --- | --- |
- | Codex | Read the `$imagegen` rules, discover the actual tool in `ALL_TOOLS`, prefer `tools.image_gen__imagegen`, and pass source images through `referenced_image_paths` |
- | Claude Code | Use the image-generation or image-editing capability installed or built into the current environment |
- | OpenClaw | Use the imagegen skill or native image action enabled for the current agent |
- | Other agents | Use an equivalent image-edit capability explicitly exposed by the tool registry |
- In Codex, the skill never guesses `tools.image_gen` or `input_image`. It returns a prompt handoff only after tool discovery confirms that no compatible image capability exists. If the real image tool fails, produces an almost unchanged image, changes identity, or dirties the skin, the skill also returns a short copy-ready prompt.
- ## Requirements
- - An agent that supports directory-based `SKILL.md` skills.
- - An image-generation or image-editing capability in the current agent.
- - Python 3.9 or newer, used only for read-only aspect-ratio, mask, and region checks.
- - Pillow 9.1 or newer, used only for read-only analysis and never to create the final image.
- Install the read-only script dependencies:
- ```bash
- python3 -m pip install -r ./xxg-portrait-rebuild-light/requirements.txt
- ```
- ## Install in Codex
- Personal skill:
- ```bash
- mkdir -p ~/.codex/skills
- cp -R ./xxg-portrait-rebuild-light ~/.codex/skills/
- ```
- Shared Agent Skills directory:
- ```bash
- mkdir -p ~/.agents/skills
- cp -R ./xxg-portrait-rebuild-light ~/.agents/skills/
- ```
- For a project-level install, place it in `.agents/skills/` at the project root. Invoke it explicitly with `$xxg-portrait-rebuild-light`.
- ## Install in Claude Code
- Personal install:
- ```bash
- mkdir -p ~/.claude/skills
- cp -R ./xxg-portrait-rebuild-light ~/.claude/skills/
- ```
- Project install:
- ```bash
- mkdir -p .claude/skills
- cp -R ./xxg-portrait-rebuild-light .claude/skills/
- ```
- Invoke it with `/xxg-portrait-rebuild-light`.
- ## Install in OpenClaw
- Local install:
- ```bash
- openclaw skills install ./xxg-portrait-rebuild-light \
- --as xxg-portrait-rebuild-light
- ```
- Shared install:
- ```bash
- openclaw skills install ./xxg-portrait-rebuild-light \
- --as xxg-portrait-rebuild-light \
- --global
- ```
- You can also copy the complete directory into the current agent workspace's `skills/` directory or the shared `~/.openclaw/skills/` directory.
- ## Install in other agents
- Copy the complete `xxg-portrait-rebuild-light/` directory into the agent's personal or project skill root. Preserve the relative structure of `SKILL.md`, `requirements.txt`, `references/`, `scripts/`, and `agents/`, then reload the skill list.
- ## Usage examples
- ### Tone and exposure correction
- ```text
- Use $xxg-portrait-rebuild-light to edit this portrait with L0 + E1 + S1 + P0 + T7 + G1 + D0 + A0.
- Keep the existing light direction. Protect bright-area shape, place facial midtones clearly, open only blocked shadows, and retain a stable black point. Neutralize the unwanted cast while preserving skin hue, white objects, wardrobe color, viewpoint, focal plane, depth of field, and scene content.
- ```
- ### Smartphone capture response
- ```text
- Use $xxg-portrait-rebuild-light to edit this portrait with L0 + E1 + S1 + P1 + T0 + G0 + D6 + A0.
- Preserve the physical light and optics. Use broad usable dynamic range, neutral skin color, restrained local tone mapping, and controlled edge sharpening; keep bright sources shaped and shadows directional, without changing crop, focal plane, or depth of field.
- ```
- ### Classic fashion editorial
- ```text
- Use $xxg-portrait-rebuild-light to edit this portrait with L8 + E1 + S2 + P3 + T1 + G1 + D2 + A0.
- A large soft key from the upper front-side creates restrained Rembrandt lighting; subtle fill preserves the eye socket, one cheek falls into a deep soft shadow, and the eyes receive one source-consistent catchlight. Keep the skin clean and healthy with low-contrast photographic microtexture.
- ```
- ### Cinematic low-key warm/cool
- ```text
- Use $xxg-portrait-rebuild-light to edit this portrait with L9 + E5 + S1 + P3 + T3 + G4 + D1 + A5.
- A warm side key shapes selected illuminated planes under explicit low-key exposure with no frontal fill. Keep cool color only in the background and rim, with extremely subtle source-aligned haze; illuminated skin remains chromatically clean and facial lines are not used for sculpting.
- ```
- ### Golden-hour backlight
- ```text
- Use $xxg-portrait-rebuild-light to edit this portrait with L10 + E2 + S1 + P2 + T2 + G1 + D1 + A4.
- Warm sunset light from the side-rear outlines the hair and shoulders. Expose for the sunset highlights with no frontal fill; let the unlit side of the face fall naturally into a partial silhouette, allow slight bloom on lit edges, and give the background matching oblique warm light and long shadows.
- ```
- ### Cyberpunk neon
- ```text
- Use $xxg-portrait-rebuild-light to edit this night portrait with L11 + E5 + S1 + P6 + T4 + G4 + D1 + A3.
- Separate the cyan rim light clearly from the magenta key while preserving a natural skin-tone zone in the center of the face. Keep bokeh only in the defocused background, never over the eyes or skin.
- ```
- ### Full-black backlit silhouette
- ```text
- Use $xxg-portrait-rebuild-light to edit this portrait with L10 + E6 + S1 + P0 + T2 + G0 + D0 + A6.
- Place the effective light behind the person and expose for the bright background. Remove all frontal and side fill, catchlights, and internal subject illumination. Render the face, skin, hair, clothing, and body as one clean continuous black silhouette while preserving the original outer contour, proportions, pose, camera view, and composition.
- ```
- ### Soft window light with window shadow
- ```text
- Use $xxg-portrait-rebuild-light to edit this indoor portrait with L2 + E1 + S1 + P2 + T1 + G0 + D0 + A1.
- Soft window light from the upper-left front creates a broad, gradual left-to-right falloff; faint room fill preserves the shadow side. One low-contrast window shadow continues across the person and adjacent wall and must not look pasted on.
- ```
- ### Portrait with tree shadows
- ```text
- Use $xxg-portrait-rebuild-light to edit this outdoor portrait with L4 + E1 + S1 + P2 + T1 + G0 + D0 + A2.
- Broad skylight illuminates the person. Sparse tree shadows break softly across facial and clothing curvature, may cross parts of the eyes and cheeks where physically plausible, and continue into the background in the same direction with source-consistent color and smooth transitions.
- ```
- ### Clean dirty AI texture and banding
- ```text
- Use $xxg-portrait-rebuild-light with L0 + E0 + S1 + P0 + T0 + G0 + D0 + A0 + Q6.
- Repair generation quality only. Remove the visible repeating synthetic texture and tonal banding while preserving natural pores, hair, directional fabric fibers, true edges, cast-shadow boundaries, color, framing, focal plane, and depth of field. Do not globally denoise, smooth, sharpen, recolor, or relight the image.
- ```
- ### Restore color after an AI edit
- ```text
- Use $xxg-portrait-rebuild-light with Q4. Image 1 is the current edit target; Image 2 is the original root base.
- Retain Image 1's intended content and lighting changes. In unchanged or unauthorized regions only, restore Image 2's skin hue, neutral objects, whites, darks, saturation relationships, and lightness curve. Preserve intentional new colors and do not add a compensating green, cyan, or magenta cast.
- ```
- ### Consolidate a degraded multi-round edit
- ```text
- Use $xxg-portrait-rebuild-light with Q5. Image 1 is the latest accepted edit; Image 2 is the first root base.
- Preserve every intended change in Image 1 once. Use Image 2 only for identity, geometry, framing, original color truth, and clean texture hierarchy. Remove accumulated color drift, repeating noise, sharpening halos, compression residue, banding, and seam buildup without smoothing natural detail or undoing the accepted edit.
- ```
- ## Output standard
- - The target key light, light-to-shadow relationship, or atmosphere effect is immediately visible at normal viewing size.
- - The subject remains the same person; facial features are neither beautified nor made artificially symmetrical.
- - Subject, clothing, and background obey the same light sources.
- - Shadow depth, highlight roll-off, and silhouette strength follow the selected exposure intent instead of flattening the scene to keep everything visible.
- - E clearly controls highlight headroom, subject midtones, directional shadows, and black point; G/D produce one coherent palette and capture response without unauthorized optical change.
- - Source complexion remains clean and continuous, with bounded source-shaped highlights and regional detail limited by scale, focus, and illumination.
- - Grain, added marks, random color variation, global sharpening, and darker facial lines are never used to imitate realism.
- - Q removes only observed generation defects; it does not flatten real texture, blur boundaries, introduce a new grade, or undo requested lighting/color changes.
- - Multi-round work always compares the current accepted edit with the first root base; intermediate raw rounds are not generation references.
- - Window shadows, tree shadows, bokeh, sunset flare, and light beams have a plausible source and landing area.
- - With `A6`, the complete subject interior is clean black with no facial, skin, hair, clothing, or catchlight detail; identity continuity is judged from the preserved outer contour, proportions, pose, and framing.
- - Preserve composition, orientation, aspect ratio, and the subject's share of the frame. Proportional downscaling to an image model's maximum resolution is allowed; exact source pixel dimensions are not required.
- ## Related files
- - [Main skill rules](SKILL.md)
- - [Compact prompt compiler](references/prompt-recipes.md)
- - [Lighting, skin, color-temperature, and atmosphere recipes](references/lighting-skin-color-temperature-recipes.md)
- - [Tone, exposure, color/style, device, and optics recipes](references/tone-exposure-style-device-recipes.md)
- - [Clean-frame quality, color-lock, and iterative-repair recipes](references/quality-repair-and-iteration.md)
- - [Backend capability notes](references/backend-and-clean-realism.md)
- - [Python dependencies](requirements.txt)
- - [Contributing guide](CONTRIBUTING.md)
- - [Changelog](CHANGELOG.md)
- ## License
- Licensed under the [MIT License](LICENSE).
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.