Skip to content

Instantly share code, notes, and snippets.

@rowe-morehouse
Created September 27, 2020 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowe-morehouse/63d19b9b1cc7cd3c488f1f48ed4c1baa to your computer and use it in GitHub Desktop.
Save rowe-morehouse/63d19b9b1cc7cd3c488f1f48ed4c1baa to your computer and use it in GitHub Desktop.
Gifsicle commands.
# Resize animated gif by scaling down 50%:
gifsicle --scale 0.5 -i animation.gif > animation-smaller.gif
# Resize animated gif to scaling to a given width with unspecified height:
gifsicle --resize-fit-width 300 -i animation.gif > animation-300px.gif
# Resize animated gif by scaling to a given height with unspecified width:
gifsicle --resize-fit-height 100 -i animation.gif > animation-100px.gif
# Resize animated gif clipping to size:
gifsicle --resize 300x200 -i animation.gif > animation-clipped.gif
# Gifsicle has three types of GIF optimization to choose from:
# -O1 - stores only the changed portion of each image. this is the default.
# -O2 - also uses transparency to shrink the file further.
# -O3 - try several optimization methods (usually slower, sometimes better results).
# - http://davidwalsh.name/optimize-gifs
gifsicle -O3 animation.gif -o animation-optimized.gif
# ---
# To optimise a GIF:
gifsicle --batch --optimize=3 <amin.gif>
# To make a GIF animation with gifsicle:
gifsicle --delay=<10> --loop *.gif > <anim.gif>
# To extract frames from an animation:
gifsicle <anim.gif> '#0' > <firstframe.gif>
# To you can also edit animations by replacing, deleting, or inserting frames:
gifsicle -b <anim.gif> --replace '#0' <new.gif>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment