primitive (https://github.com/fogleman/primitive) recreates an image by adding one shape at a time, each placed to best reduce the difference from the original. A few hundred triangles give a recognizable low-poly version, saved as a small, scalable SVG. Pair it with ffmpeg by extracting frames (stills-and-gifs/extract-frame-jpg.sh, or -vf fps=… to frames/), redrawing each one, and reassembling the rendered frames with image-sequence/.

The command

shopt -s nullglob
mkdir -p svg

for f in *.png; do
  primitive -i "$f" -o "svg/${f%.*}.svg" -m 1 -n 150   # 150 triangles
  # primitive -i "$f" -o "svg/${f%.*}.svg" -m 6 -n 300 # 300 Bézier curves
done

What each part does

-i / -o                input image / output file (.svg, .png, .jpg or
                       .gif, chosen by extension)
-m                     shape mode: 0 combo, 1 triangle, 2 rectangle,
                       3 ellipse, 4 circle, 5 rotated rectangle,
                       6 Bézier curve, 7 rotated ellipse, 8 polygon
-n                     number of shapes (more = more detail, slower)

When to use it

Use this to turn every PNG in the current folder into a low-poly SVG made of simple shapes, written to svg/. It suits stylized stills, posters, and frame-by-frame animation where a rough, painterly look is the point. Skip it when you need fine detail or readable text, or when you have thousands of frames and little time: every image is redrawn from scratch, one shape at a time.

For video, extract frames first (for example with extract-frame-jpg.sh, saved as PNG), run this script, then reassemble the frames with svg-frames-to-prores4444-alpha.sh or image-sequence-2-video.sh.

Variations: switch to the commented Bézier line, try another -m mode, or change -n. The header explains each flag.

If something looks wrong:

  • Nothing in svg/: the script only matches *.png in the current folder and quietly does nothing if there are none.
  • primitive: command not found: the Go bin folder (often ~/go/bin) isn't on your PATH.
  • Too abstract: raise -n. Too slow: lower it.

Notes

Install
go install github.com/fogleman/primitive@latest (needs a recent Go toolchain)
Source
ffmpeg-utilities/png-svg.sh
Changed
name=`echo "${i%.*}"` → "${f%.*}"; mkdir -p for the output folder; nullglob Not tested here: primitive is a separate install.