Skip to content

Instantly share code, notes, and snippets.

@grocky
Created October 17, 2020 15:52
Show Gist options
  • Save grocky/10b9df9c2c5452c361075aa48eb57676 to your computer and use it in GitHub Desktop.
Save grocky/10b9df9c2c5452c361075aa48eb57676 to your computer and use it in GitHub Desktop.
Creating gifs and videos from a collection of images

Notes on creating gifs and videos from a colleciton of images

Great notes on this blog: How to create GIFs with FFmpeg

Format filenames

Rename all of the target images to have a sequential naming scheme.

a=1; for i in *.png; do new=$(printf "%04d.png" "$a"); mv -i -- "$i" "$new"; let a=a+1; done

GIFs

Create GIF with a few files

convert -delay 10 -loop 0 *.png output.gif

Create a GIF with large amount of files (>100)

ffmpeg -i %04d.png output.gif

GIF from slides

magick -density 600 file.pdf file_frame%02d.png
magick -delay 50 -loop 0 file_frame*.png out.gif

Videos

When there are a large amount of high quality images, it mya be more efficient to create a video instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment