xxg-portrait-rebuild-light README

The project's README from github.com/moskoo/xxg-portrait-rebuild-light. As one markdown file: README.md.

xxg-portrait-rebuild-light skill-logo

XXG Portrait Rebuild Light

MIT License Python codex Claude OpenClaw Version 2.1.0

English | 简体中文 | 日本語 | 한국어

xxg-portrait-rebuild-light is an image-edit skill for existing portraits. V2.1 separately controls physical light, exposure placement, color/style grade, capture-device response, broad skin tone, bounded reflection, and scale/focus-aware microdetail.

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

演示图片 演示图片 演示图片 演示图片

Core method

The skill first makes a director-style lighting decision internally:

Scope → Key L → Exposure E → Fill/Shadow → Skin S/P → Light color T → Look G → Capture D → Atmosphere A

The prompt sent to the image model uses four compact lines, adding RENDER only for a requested grade or device response. Target length is 55–110 English words:

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.
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.1 forces L0 + E0 + T0 + G0 + D0 + A0. Tone correction changes only E/T/G; capture-style changes only G/D and a logically required E. Relighting changes L/E/T/A. 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:

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

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

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

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

See Lighting, skin, color-temperature, and atmosphere recipes 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

Install the read-only script dependencies:

python3 -m pip install -r ./xxg-portrait-rebuild-light/requirements.txt

Install in Codex

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.

Install in Claude Code

Personal install:

mkdir -p ~/.claude/skills
cp -R ./xxg-portrait-rebuild-light ~/.claude/skills/

Project install:

mkdir -p .claude/skills
cp -R ./xxg-portrait-rebuild-light .claude/skills/

Invoke it with /xxg-portrait-rebuild-light.

Install in OpenClaw

Local install:

openclaw skills install ./xxg-portrait-rebuild-light \
  --as xxg-portrait-rebuild-light

Shared install:

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

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

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

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

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

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

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

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

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

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.

Output standard

License

Licensed under the MIT License.

xxg-portrait-rebuild-light (moskoo/xxg-portrait-rebuild-light)

Searching Database…

Что это?Это навык редактирования изображений (пакет SKILL.md), который AI-кодинг-агенты вроде Codex, Claude Code и OpenClaw могут загрузить, чтобы переставить освещение на существующих портретных фото и вернуть коже чистую низкоконтрастную текстуру, используя рабочий процесс света в стиле режиссёра, а не перерисовывая человека.
Это отдельное приложение или то, чем пользуется AI-агент?Это пакет навыка (SKILL.md плюс скрипты и справочные файлы), который кладётся в папку навыков агента — у него нет собственного интерфейса, и он полностью полагается на встроенную способность агента-хоста генерировать и редактировать изображения.
Как установить этот навык?Скопируйте папку xxg-portrait-rebuild-light в каталог навыков вашего агента: для Codex — личный или общий (вызов через '$xxg-portrait-rebuild-light'), для Claude Code — личный или проектный (вызов через '/xxg-portrait-rebuild-light'), для OpenClaw — локальный или общий, затем перечитайте список навыков.
Нужен ли для этого API-ключ генерации изображений?Отдельный API-ключ не нужен — используется та способность генерации или редактирования изображений, которая уже встроена в вашего агента. Нужны только Python 3.9+ и Pillow 9.1+, и лишь для проверок соотношения сторон и масок в режиме только чтения.
Что будет, если мой агент на самом деле не умеет редактировать изображения?Если у агента нет совместимой способности работать с изображениями или правка не попадает в цель, навык возвращается к выдаче одного компактного, готового к копированию промпта для редактирования изображения вместо самой картинки.
Что означают коды L, E, S, P, T, G, D, A?Это рецепт-система навыка — освещение (L0-L12), экспозиция (E0-E7), масштаб кожи (S0-S2), финиш кожи (P0-P6), цветовая температура (T0-T7), грейдинг (G0-G8), отклик съёмки/устройства (D0-D8) и атмосфера (A0-A6) — всё собирается в один компактный промпт для выбранного вида.
Почему для финального изображения не используются Pillow, NumPy и OpenCV?Эти библиотеки служат только для проверок в режиме чтения вроде соотношения сторон и масок; само итоговое изображение всегда выдаёт настоящая модель генерации изображений агента, чтобы свет и кожа оставались физически связными, а не имитировались фильтрами.
Может ли это изменить позу или личность человека?Нет — он задуман менять только освещение, текстуру кожи, цвет и атмосферу, явно сохраняя личность, структуру лица, выражение, позу, ракурс камеры и композицию.
Что за режим силуэта A6?A6 создаёт полностью чёрный контровой силуэт, перемещая действующий источник света за объект и убирая всю заполняющую подсветку и блики в глазах, — он прячет все детали лица и кожи, оставляя видимыми позу и контур.
Creator
moskoo
Size
4.4 MB
Stars
218
Age
2mo
Commits · 90 Days