Conform a still to 1080p
Give it an image and a target size; get a frame at exactly that size, centre-cropped to
the target's aspect and resampled with Lanczos. Nano banana's 2K 16:9 output is
2752x1536 (aspect 1.792, a little wider than 16:9), so a straight resize would squash it:
this trims about 11 px off each side, then scales by 0.703. Use it on every 2K render
before the still is used anywhere at delivery size. To move a crop back into a full frame
(only the changed pixels), use python-crop-and-paste-back instead.
Inputs
- The render, full size (keep it: angles, stagings and crops start from the 2K original).
- The target size:
1920 1080for 16:9 (the default),1080 1920for 9:16; otherwise the delivery size inAGENTS.md. - Optional
--box X0 Y0 X1 Y1, in pixels of the input: a crop taken first. Give it the target's aspect, or the fit centre-crops it again.
Run it
Write the script in references/conform_to_1080p.md into the project folder as is, then:
exec("python", ["conform_to_1080p.py", "<set>/raw/main_a.png", "<set>/main_a.png"], cwd="<job>")
exec("python", ["conform_to_1080p.py", "<in>", "<out>", "--size", "1080", "1920"], cwd="<job>")
Keep the full-size render in a raw/ folder beside the conformed one, under the same
name, so the next edit can find the original.
To reframe a plate tighter (a medium shot out of a wide angle), crop the 2K plate and scale it back up to 2K, so the next edit gets full resolution:
exec("python", ["conform_to_1080p.py", "<set>/angles/raw/podium_c.png", "<set>/plates/podium_medium.png",
"--box", "688", "384", "2064", "1152", "--size", "2752", "1536"], cwd="<job>")
For an element crop used as a reference (a podium cut from the main image), pass a
--size equal to the box's size so nothing is resampled.
What you get
The output image (RGB) and one JSON line on stdout: input_size, box, fit_crop (the
region kept, in the box's pixels), trimmed_px per side, scale (output px per kept
px) and output_size. A 2752x1536 render to 1920x1080 reports about 10.7 px trimmed
left and right, 0 top and bottom, scale 0.7031.
Tips and traps
- Render at 2K, then conform. 1K 16:9 is only 1376x768, too small for 1080p. Never render at 4K and downscale: it averages the film grain away and redraws background faces.
- Conform each render once, from the original. Conforming a conformed image, or re-saving as JPEG between steps, softens it a little more each time.
- Render at the target aspect (
aspect_ratioin theruninput). A trim much larger than a few pixels means the render came back at another aspect, and ascaleabove 1 means you are upscaling: re-render rather than crop people off or soften the frame. - A box at another aspect than the target loses its edges to the centre-crop; read
trimmed_pxto see how much.
Check it
output_size equals the target, and trimmed_px is a few pixels on one axis and zero on
the other for a 2K render. Open the output beside the raw render once per batch: nothing
at the frame edges that matters should be gone.


