Let’s say we have following four images

head 1 head 2 head 3 head 4

and want to create animated one. Command

ffmpeg -framerate 4 -i head_%d.png -loop 0 head.webp

can be use to produce lossy animated image in WEBP format supported by mayor browsers like Firefox and Chrome. The command produce

animated head

tip: we can create animated image also from video input, in this case just use -i video.mkv

WEBP related ffmpeg options can be found in 9.10 libwebp ffmpeg’s documentation.