A new delivery kind for fotos.zerozero.pt: the server signs in with the photographer's zerozero.pt account (OAuth through ax_login.php), finds the event's game among the desk's upcoming games by teams and kick-off (or uses a pasted link), and uploads with tus, with the photographer as the author. "Only the best": an autopilot selection that delivers a short gallery of game moments (about N photos), spread over the match in 5-minute windows with unused shares carried forward, ranked by action (ball, duels, celebrations, big sharp subjects, stars), without twins. After the match, "Melhores..." sends the best N of an event the same way. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HT6iXLYUUp9pJz5Kza9xCW
7.6 KiB
Photo editing rules (autopilot and automatic crop)
What the automatic editor may do to a news or sports photo, and how it chooses. These rules are the contract for
apps/api/src/composition/ and apps/api/src/autopilot/. Peter (and any editor) can tighten them per
organisation or event; nothing here may be loosened past the ethics section.
1. Ethics (fixed)
Following the AP and NPPA codes:
- Allowed: crop, straighten, white balance, exposure and contrast, colour and toning "minimally needed for clear, accurate reproduction", conversion to black and white, dust removal.
- Not allowed: adding, removing, moving or cloning anything in the scene; blurring or darkening the background to hide it; changes of density, contrast, colour or saturation that alter the scene; obscuring faces.
- A crop must not change what happened. If removing someone changes the story (the defender in a duel, the referee showing a card, the goalkeeper facing the shot), they stay.
- Every automatic edit is an ordinary, undoable step in the photo's edit history, marked as made by the autopilot. The original is never touched.
2. Crop
- Who: the subject is the person in focus, not the biggest one. With a ball in play, the ball and everyone contesting it. Without one, the subject and the sharp people with them (a duel, a celebration, a line-up).
- Shape: the photo's own aspect unless the event or the editor chose another. Peter's usual crop is about two thirds of the frame; larger only when the subject needs it.
- Never cut: heads, faces, hands holding the ball, the ball itself.
- Limbs: if a body has to be cut, cut mid-limb (mid-thigh, mid-shin, mid-forearm), never at a joint (ankle, knee, hip, wrist, elbow, neck). The engine estimates joints from the body box and avoids crop edges there.
- Feet: keep whole bodies when they fit; otherwise cut above the knee rather than at the ankle.
- Edges: no slivers of other in-focus people at the crop edge: either in, or out. Blurred foreground and background people don't count.
- Headroom: heads a little below the top edge, not touching it, not floating in empty space.
- Vertical placement: the upper body (chest, faces) a little above the middle of the crop, never the knees. Little or no empty pitch or floor under the feet: when the crop is taller than the subject, the spare height goes above them (crowd, stands), not below.
- Distractions: prefer the crop that leaves out half-bodies, empty floor and bright clutter at the edges, as long as nothing that matters goes with them.
- Resolution: never crop below what the delivery needs. Default: the crop keeps at least 2400 px on its long edge of the original (configurable per organisation; agencies often ask for more).
- Not too much: if the only crop that works is tighter than the resolution allows, keep the wider frame. A good photo uncropped beats a bad crop.
3. Bursts (sequences)
A camera at 10–30 frames per second sends several photos of the same moment.
- A burst is a run of photos from the same camera with less than 1.5 s between frames (configurable).
- Score of each frame: sharpness of the subject (focus landed on them, no motion blur), subject size, ball in frame and near the subject, faces visible. Ties go to the earliest frame (usually the peak of the action).
- Keep: the best 1–2 frames per burst (configurable), flagged as picks. The rest stay unflagged (never rejected or deleted automatically).
- Variety: when two frames of a burst are kept, the second gets a slightly different crop (tighter or wider) so the client has a choice.
- Saturation: an event can cap how many picks one burst, or one minute of play, may produce, so a long attack doesn't flood the delivery.
4. Autopilot
Per event (and an organisation default), off unless switched on. When on, every photo that arrives through FTP, the local FTP of the desktop app or auto-ingest is, in order:
- analysed (people, ball, focus);
- edited: white balance, tone, level (only with a clear horizon or verticals, at most a few degrees), crop. The level reads the advertising boards, stands, posts and railings, never the pitch markings (lines on grass), which perspective tilts; when those lines disagree the photo is left as it is;
- scored within its burst; when the burst ends, its best frames are flagged as picks;
- optionally delivered (rendered with the edits, IPTC from the event) to the event's delivery target.
Uploads made by hand in the browser are not touched. Anything the autopilot did can be undone, changed or reset in Revelar.
Learning from corrections
When someone changes a photo the autopilot edited, the difference (final minus autopilot, per control; and the
crop area against the autopilot's) is kept, one per photo, latest state wins (develop_corrections,
apps/api/src/autopilot/learning.ts). For the next photos of the same photographer the autopilot adds, to its own
measurement, the median of the last 60 corrections, at the same venue when there are at least 5 there:
- only the controls it sets itself (tone, white balance) and crop tightness, never a creative look;
- only with 5 or more corrections, and only when at least 70% of them go the same way (one odd photo changes nothing); tiny differences are noise and very large ones creative choices, both ignored;
- the crop only gets tighter, never cutting into the subject (looser would eat the margins the subject needs).
The autopilot's panel in the app shows what it has learnt and has "Esquecer". The burst picks are not learnt yet.
5. Only the best
Some clients (ZeroZero) want a short gallery of the match, not every usable frame. With "Só as melhores do
jogo" the autopilot still flags each burst's picks for the photographer, but delivers only a curated set of
about the gallery size asked (apps/api/src/autopilot/curate.ts):
- the match (from kick-off, its typical length by sport: football 115 min with the break, handball 80) is cut into 5-minute windows; each window may add its share of the gallery, and a share it did not use (the break, a quiet spell) carries forward, at most three windows' worth at once; at most 10% over the size in all;
- one candidate per burst (its best frame), ranked by game moment: the frame score, more with the ball in play (×1.3), a duel or a celebration (several people in the subject), less when the subject is small (far away); the photographer's stars count (+20% each), a rejected frame never goes;
- frames well below the match's typical frame (half the median) are left out even when the window has room, and never two frames of the same moment (8 s);
- warm-up and line-ups (more than 5 minutes before kick-off) are not candidates;
- a window is decided a minute after it ends, so the gallery reaches the client with about 6 minutes' delay.
After the match, "Melhores…" in the library sends the best N of the event the same way (filling up to N with the best frames left when the windows' shares fall short); without the autopilot, stars and picks rank.
Sources
- AP and NPPA codes, summarised by the CUNY Newmark J-School: https://photo.journalism.cuny.edu/?p=201
- Cropping at mid-limb, not at joints; keep meaning; avoid clutter: https://www.walsworthyearbooks.com/top-10-essential-rules-for-good-photo-cropping/
- Burst culling criteria (subject sharpness, eyes, ball, peak action, 1–3 per burst): https://filterpixel.com/blog/sports-photography-burst-mode-culling
- Peter's own Lightroom crops (65 picked photos, handball, October 2026): crops in the photo's aspect, often exactly two thirds of the frame, straightening of 0.5–3.3°.