¿Qué hace photo-compose?
Intelligent, reversible composition stage. It sits between photo-cull and
photo-develop:
photo-cull -> photo-compose -> photo-develop -> photo-export
It never develops tone and never exports pixels; it only decides geometry (orientation, straighten angle, crop rectangle) and writes it as XMP + a JSON manifest + a review report.
Non-negotiables
- Originals are read-only. No source edit, no source XMP overwrite, no
sidecar written next to originals. Everything goes under
--output. - Non-destructive and reversible. Geometry lives in XMP; the manifest keeps the original orientation, all candidates and every parameter.
- Do not duplicate photo-develop. Tone/exposure/WB belongs to develop.
photo-compose writes only
crs:HasCrop/CropLeft/CropTop/CropRight/CropBottom/ CropAngle/Orientation(+ provenance). - Deterministic geometry. Crop fractions, angle, output resolution are computed in code. A model may supply semantics (scene, intent, protected regions, focal elements), never coordinates.
- CPU only, no network. Models are the ones already bundled by siblings.
- Siblings are reused, never reimplemented: photo-render (decode, orient, straighten+crop, XMP parse), photo-develop (raw decode, cull selection), photo-cull (scores.json, face model), photo-export (render+export).
Quick start
$S = "C:\path\session"
# 1) cull first (or reuse an existing pre-cull-report)
python "$env:USERPROFILE\.config\opencode\skills\photo-cull\scripts\run_pipeline.py" `
--source $S --output "$S\pre-cull-report" --no-faces
# 2) compose: straighten + smart crop + XMP + report
python "$env:USERPROFILE\.config\opencode\skills\photo-compose\scripts\run_pipeline.py" compose `
--source $S --cull "$S\pre-cull-report" --output "$S\photo-compose"
# 3) review: open $S\photo-compose\compose-report.html (or serve + persist)
python "$env:USERPROFILE\.config\opencode\skills\photo-compose\scripts\run_pipeline.py" serve `
--output "$S\photo-compose" --port 8765
# 4) apply accepted/rejected/adjusted decisions
python "$env:USERPROFILE\.config\opencode\skills\photo-compose\scripts\run_pipeline.py" apply-decisions `
--output "$S\photo-compose" --decisions "$S\photo-compose\compose-decisions.json"
# 5) merge geometry into photo-develop XMP, then render/export
python "$env:USERPROFILE\.config\opencode\skills\photo-compose\scripts\run_pipeline.py" merge `
--compose-xmp "$S\photo-compose\xmp" --develop "$S\photo-ai\xmp" --output "$S\xmp-merged"
One command for the whole chain (reusing siblings' CLIs):
python "$env:USERPROFILE\.config\opencode\skills\photo-compose\scripts\run_pipeline.py" pipeline `
--source $S --work "$S\..\session-work" --sample 5
What it decides, in order
- Orientation — EXIF/CRS 1–8 applied first (same as photo-render).
- Straighten — measures the horizon tilt from line segments. Corrects only
accidental tilt (
|tilt| >= --min-angle-deg, default 0.4°, confidence ≥ 0.25,|angle| <= --max-angle-deg). Intentional tilt is preserved with--preserve-tiltorsemantic.intentional_tilt. - Crop — candidate crops per aspect; must keep the primary focal element
fully inside, never slice a protected region, never leave the black-free
(inscribed) area created by rotation, and keep at least
--min-keepof the usable area. - Selection — a candidate replaces the original only with clear
improvement (
--min-improvement, default 0.02). Well-composed photos are left untouched.
Scoring is a blend of thirds/golden points, balance, symmetry, level, framing, gaze space, movement space, negative space, context retention, resolution, primary-focus prominence and edge distraction. All are heuristics: a better photo is not automatically a rule-of-thirds photo, and a face is not automatically the subject.
Multimodal semantic pass (optional, recommended)
photo-compose writes semantic-template.json. A multimodal agent fills it,
then re-runs compose with --semantic semantic.json:
{ "per_stem": {
"DSC01234": {
"scene": "portrait",
"intentional_tilt": false,
"symmetry": true,
"focal_elements": [
{"type": "person_face", "box": [0.31,0.18,0.52,0.44], "score": 0.9,
"gaze": [0.8,0.1], "moving": false, "protect": true}
],
"protected_regions": [[0.25,0.10,0.60,0.95]],
"confidence": 0.8,
"needs_manual_review": false,
"notes": "give gaze room to the right; keep the doorway"
}
}}
Resume/cache is keyed on source sha256 + parameters + semantic; re-running is cheap and only the changed photos recompute.
Outputs (under --output)
| Path | Meaning |
|---|---|
compose-manifest.json | everything: geometry, focal elements, scores, alternatives, rationale, confidence, review flags, schema |
meta.json | run summary + honesty statement |
xmp/<stem>.xmp | geometry-only XMP (photo-render applies orientation→straighten→crop) |
xmp-merged/<stem>.xmp | only if --merged-develop: geometry + develop tone |
previews/<stem>_before.jpg | EXIF-corrected original |
previews/<stem>_after.jpg | selected geometry |
previews/<stem>_overlay.jpg | crop rectangle, horizon line, thirds grid, saliency centre |
compose-report.html | interactive before/after + alternatives + decisions |
compose-decisions.json | decisions (from serve/export) |
applied/ | apply-decisions output (XMP + summary) |
semantic-template.json | template for the multimodal pass |
.state.json | resume checkpoint |
Coordinates and transform order
Normalized [0,1], origin top-left, x→right, y→down. Order:
orientation → straighten → crop → downscale, matching
photo-render.pipeline.render._straighten_and_crop.
crs:CropAngle is clockwise degrees; crop = L,T,R,B fractions of the
straightened frame.
Honesty limits
- No pose/limb model is bundled: body detection and movement come from the semantic layer; nothing is fabricated.
- Profile faces and very small faces may be missed (MediaPipe + Haar fallback).
- Saliency is not semantics: a bright sky can be salient and still not be the subject.
- No Adobe Lightroom / Capture One pixel parity claim.
--sample Nprocesses the first N keepers only and is not a full-batch claim.
References
references/workflow.md— step-by-step operational guide and integration recipes.references/manifest-schema.md— every manifest field.references/semantics.md— semantic.json contract and how it is merged.references/limits.md— known limits and how to verify them.