Match the source's push-in on a pinned last frame
You give it the source shot's first and last frames, your locked first frame and your
derived last frame; you get the last frame cropped to the source's push-in, at
1920×1080. Use it on every last frame made with nano-banana-derive-last-frame when
the source shot moves in: the image model keeps the framing whatever the prompt says,
and a pinned pair with no zoom makes the video lose the push-in.
Inputs
- The source shot's first and last frames (stills at their exact frames).
- Your locked first frame (1080p).
- Your derived last frame: pass the 2K render (2752×1536), not a 1080p copy, so the crop keeps resolution.
Run it
Write references/push_in.md's script into the project folder as push_in.py,
unchanged, and run it with exec python:
exec python push_in.py --source-first <job>/shots/shot09_first.jpg --source-last <job>/shots/shot09_last.jpg \
--first <job>/stills/shot09_first_p.png --last <job>/stills/shot09_last_n.png --out <job>/stills/shot09_last_r.png
It measures the source's move (zoom about the centre plus shift, searched from 0.80 to 1.25 in steps of 0.005), measures how your last frame already sits against your first, crops the difference out of the 2K render, and conforms the crop to 1080p. It tries both signs of the shift and keeps the crop that lands closer.
What you get
JSON on stdout:
target: the source's last frame against its first.zoombelow 1 is a push-in (0.94 is about 6% in);shift_pxis the drift at 1080p;matchis the correlation after alignment (1.0 identical, a shot's own first against last ≈ 0.86).ours_before: your uncropped last frame against your first (usually zoom ≈ 1.0).got: the written crop against your first. It should equaltarget.miss_px: |zoom error| × 1920 plus the shift errors in px.
Check it
got.zoomwithin 0.005 oftarget.zoomand the shift within a few px;miss_pxin single digits to the low teens. Larger means the alignment locked onto the wrong thing (a big moving subject): check the frames, then re-run.- Flip first and pushed-in last on a review page: the set should grow evenly with nothing jumping.
- The crop changes the scale of everything, small print included. Fix the logo after
this step, on the cropped frame, with a match reference cut at the same scale
(
nano-banana-rerender-small-print,match-cutinpython-crop-and-paste-back). A logo matched at a different scale changes width and slides across the prop mid-clip.
The full first-frame, last-frame, push-in, print sequence and its gates:
guide-keep-small-details.


