Skip to main content

Gifsicle is a command-line tool for creating, editing, and getting information about GIF images and animations.

# To optimize a GIF as a new file:
gifsicle <path/to/input.gif> --optimize=3 -o <path/to/output.gif>

# To unoptimize a GIF in place:
gifsicle -b <path/to/input.gif> --unoptimize

# To extract a frame from a GIF:
gifsicle <path/to/input.gif> '#<0>' > <path/to/firstframe.gif>

# To make a GIF animation from selected GIFs:
gifsicle <*.gif> --delay=<10> --loop > <path/to/output.gif>

# To reduce file size using lossy compression:
gifsicle -b <path/to/input.gif> --optimize=3 --lossy=<100> --colors=<16> --dither

# To delete the first 10 frames and all frames after frame 20 from a GIF:
gifsicle -b <path/to/input.gif> --delete '#<0-9>' '#<20->'

# To modify all frames of a GIF using specific transformation options:
gifsicle -b --crop <50>,<50>+<-50>x<-50> --scale <0.25> --flip-horizontal --rotate-90 <path/to/input.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>