Hypernatural

TechniqueBy HypernaturalVersion 1, Oct 21, 2026

python-crop-and-paste-back

Cut a small region (a logo, a label, a badge, a pin) out of a frame, enlarge it for an image-model edit, then paste only that region back so the rest of the frame stays bit-identical: grain, faces and background untouched. Also keeps a full-frame edit only inside a box after aligning it to the original. Use for any small fix on a still that a whole-frame pass would smooth.

SKILL.md

Crop a region, edit it big, paste it back

You give it a frame and a box around something small; it writes an enlarged crop for the image model, then takes the model's edit and pastes back only that region. Every pixel outside the box (and, in the default mask, every pixel the model didn't change) stays exactly as it was. Use it whenever a fix is smaller than the frame: a whole-frame edit garbles small lettering and every extra full-frame pass smooths grain and background faces. The edits themselves are in nano-banana-rerender-small-print (print and logos) and nano-banana-remove-small-object (badges, pins, stains).

Run it

Write references/crop_paste.md's script into the project folder as crop_paste.py, unchanged, and run it with exec python. Every command prints JSON.

exec python crop_paste.py crop --image <frame> --box x0,y0,x1,y1 --scale 6 --out <job>/refs/shot09_last_crop.png
exec python crop_paste.py match-cut --image <frame> --box x0,y0,x1,y1 --other <other pinned frame> --center x,y --out <job>/refs/shot09_last_match.png
exec python crop_paste.py paste --image <frame> --box x0,y0,x1,y1 --edit <model output> [--mask changed|circle] --out <frame>_<letter>.png
exec python crop_paste.py patch-box --original <approved still> --edited <full-frame edit> --box x0,y0,x1,y1 --out <patched>.png
  • Boxes are square and in the working frame's pixels. The edit is asked for at 1:1, so a non-square box comes back stretched. crop, match-cut and paste conform the frame to 1920×1080 first (centre-crop to 16:9, then Lanczos) unless you pass --no-conform, which keeps the image's own pixels (a 2752×1536 2K still). Use the same choice for crop and paste. Find the box on a gridded crop of the frame.
  • --scale: 6 for print and logos (a 200 px box becomes 1200 px, so the prop fills the model's image), 4 for a removal (~256 px at 2K becomes 1024 px).
  • paste --mask changed (the default, for print): the edit is shrunk back with Lanczos, and only pixels whose mean RGB difference from the crop exceeds --threshold 14 (0–255) go back, grown 5 px and softened 2 px. Hands, hair and grain the model left alone stay original.
  • paste --mask circle (for a removal): a circle centred on the box, touching its shorter side, feathered by --feather px. Centre the box on the object. The right feather depends on the surface (a knit, skin, a flat wall): start at the default 8 px, paste two or three widths, and let the person pick on a review page before patching every frame.
  • match-cut cuts the same prop from the shot's other pinned frame at the same scale as the box crop: the box is scaled by the zoom between the two frames, measured unless you pass --match-scale (other-frame px per this frame's px; 0.94 when this frame is pushed in 6% from the other). --center is the prop's centre in the other frame at 1080p. Give it to the model as the print-placement reference.
  • patch-box is for an edit already made on the whole frame: it aligns the edit to the original (zoom about the centre plus shift), then keeps it only inside the box through a mask feathered 12 px. A whole-frame edit comes back 0.5–1% zoomed with every pixel nudged (PSNR ~23–26 dB against the approved still), so never use it unaligned.

What you get

crop: the enlarged crop plus frame_size, box, crop_size, enlarged_size and square. paste: the patched frame plus mask_px (pixels the mask took, > 0.5) and changed_px (pixels that differ from the input at all). match-cut: the reference and the match_scale used. patch-box: the patched frame and the alignment (match, zoom, shift_px) it applied.

Check it

  • changed_px should be a small patch: a badge removal changed about 9k px and left the face and grain bit-identical. A count near the whole box on a print fix means the model re-lit or re-grained the crop: re-run the edit, don't paste it.
  • Look at the patched frame at 100% around the box edge for a seam, and next to the input on a review page. Judge a logo at playback size too.
  • For grain inside the patch, compare python-measure-detail on the patch before and after.
  • After a patch, conform a --no-conform 2K result to 1080p with python-conform-to-1080p.

Why a crop, and how the references are conditioned for it: guide-keep-small-details.

Go make something cool.

Install the app, open your agent, describe the video. That's the whole onboarding.

Sticker HypernaturalSticker BannerSticker TVBoy