#!/bin/sh rm img/*.gif waitjobs() { while [ "$(jobs -p | wc -l)" -ge "$1" ]; do wait; done } for x in img/*.pam; do echo "$x" pamtogif -quiet "$x" > "$x.gif" & waitjobs "$(nproc)" done wait gifsicle -d1 --verbose img/*.gif > anim.gif ffmpeg -i anim.gif -filter:v "setpts=0.1*PTS,scale=iw*4:ih*4:flags=neighbor" -r 100 anim.webm