Skip to content

Instantly share code, notes, and snippets.

@masadcv
Last active October 9, 2021 03:01
Show Gist options
  • Save masadcv/9ba29dc98e6506453e87fc3481b363a0 to your computer and use it in GitHub Desktop.
Save masadcv/9ba29dc98e6506453e87fc3481b363a0 to your computer and use it in GitHub Desktop.
Creating GIF Animations

Extract and crop images from MP4

mkdir cropped
for f in *.jpg *.png; do
    echo convert "$f" -crop 1866x1050+54+29 cropped/"$f"
    convert "$f" -crop 1866x1050+54+29 +repage cropped/"$f"
    convert cropped/"$f" -resize 50% cropped/"$f"
done

Make gif and compress:

convert -delay 10 *.png all.gif  

gifsicle -O3 --colors=128 --lossy=80 --use-col=web all.gif -o allnew.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment