Gifsicle is a command-line tool for creating, editing, and getting information about GIF images and animations. Making a GIF animation with gifsicle is easy.

# 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).
# -
gifsicle -O3 animation.gif -o animation-optimized.gif