← BACK TO work
Personal tool2026Working

Cutout Animator

A static cutout in, a looping animation out.

The problem

A static subject cutout needed to become a reusable social loop in several aspect ratios and styles without paying for a metered animation or background-removal API. The source was not always a clean transparent PNG; sometimes it was a person on a near-black field.

What it does

Turns a static subject cutout — a person on a black field, or a transparent PNG — into a polished looping animation, in several styles from one command.

Pure ffmpeg and Pillow, nothing metered and no API, following the same zero-cost rule as everything else here. Outputs an mp4 per style, a gif fallback, and a still preview so you can check it without opening a player.

Why it is built this way

I kept the pipeline to ffmpeg and Pillow and emit MP4, GIF and a still preview in one run. When alpha is missing, background removal discards only dark regions connected to the frame edge; a simple colour key was rejected because it would punch holes through enclosed black hair and dark clothing.

What was hard

VP9 stores alpha in a side stream that ffmpeg's decoder does not reconstruct, so the transparent GIF cannot safely be derived from the WebM. It is rendered from a lossless RGBA intermediate instead.

Outcomes

  • Zero cost per run
  • Multiple styles per command
  • mp4 + gif + preview

Stack

PythonffmpegPillow