Gifsicle manipulates GIF images. Its most common uses include combining
single images into animations, adding transparency, optimizing animations for
space, and printing information about GIFs.
Usage: gifsicle [OPTION | FILE | FRAME]...
Mode options (at most one, before any filenames):
-m, --merge Merge mode: combine inputs, write stdout
-b, --batch Batch mode: modify inputs, write back to
same filenames
-e, --explode Explode mode: write N files for each input,
one per frame, to 'input.frame-number'
-E, --explode-by-name Explode mode, but write 'input.name'
General options (also --no-OPTION for info and verbose):
-I, --info Print info about input GIFs
-I -I Print info to standard error; do not suppress
normal output
--color-info, --cinfo --info plus colormap details
--extension-info, --xinfo --info plus extension details
--size-info, --sinfo --info plus compression information
-V, --verbose Print progress (files read and written)
-h, --help Print this message and exit
--version Print version number and exit
-o, --output FILE Write output to FILE
-w, --no-warnings Don't report warnings
--no-ignore-errors Quit on very erroneous input GIFs
--max-screen WxH Reject logical screens bigger than WxH
[16384x16384]
--conserve-memory Conserve memory at the expense of speed
--nextfile, --multifile Support concatenated GIF files
Frame selections: #num, #num1-num2, #num1-, #name
Frame change options:
--delete FRAMES Delete FRAMES from input
--insert-before FRAME GIFS Insert GIFS before FRAMES in input
--append GIFS Append GIFS to input
--replace FRAMES GIFS Replace FRAMES with GIFS in input
--done Done with frame changes
Image options (also --no-OPTION and --same-OPTION):
-B, --background COL Make COL the background color
--crop X,Y+WxH, --crop X,Y-X2,Y2
Crop the image
--crop-transparency Crop transparent borders off the image
--flip-horizontal, --flip-vertical
Flip the image
-i, --interlace Turn on interlacing
-S, --logical-screen WxH Set logical screen to WxH
-p, --position X,Y Set frame position to (X,Y)
--rotate-90, --rotate-180, --rotate-270, --no-rotate
Rotate the image
-t, --transparent COL Make COL transparent
Extension options:
--app-extension N D Add an app extension named N with data D
-c, --comment TEXT Add a comment before the next frame
--extension N D Add an extension number N with data D
-n, --name TEXT Set next frame's name
--no-comments, --no-names, --no-extensions
Remove comments (names, extensions) from input
Animation options (also --no-OPTION and --same-OPTION):
-d, --delay TIME Set frame delay to TIME (in 1/100sec)
-D, --disposal METHOD Set frame disposal to METHOD
-l, --loopcount[=N] Set loop extension to N (default forever)
-O, --optimize[=LEVEL] Optimize output GIFs
-U, --unoptimize Unoptimize input GIFs
-j, --threads[=THREADS] Use multiple threads to improve speed
Whole-GIF options (also --no-OPTION):
--careful Write larger GIFs that avoid bugs in other
programs
--change-color COL1 COL2 Change COL1 to COL2 throughout
-k, --colors N Reduce the number of colors to N
--color-method METHOD Set method for choosing reduced colors
-f, --dither Dither image after changing colormap
--gamma G Set gamma for color reduction [2.2]
--lossy[=LOSSINESS] Alter image colors to shrink output file size
at the cost of artifacts and noise
--resize WxH Resize the output GIF to WxH
--scale XFACTOR[xYFACTOR] Scale the output GIF by XFACTORxYFACTOR
--resize-width W Resize to width W and proportional height
--resize-height H Resize to height H and proportional width
--resize-fit WxH Shrink to fit WxH, preserving aspect ratio
--resize-touch WxH Resize to touch WxH, preserving aspect ratio
--resize-geometry GEOM Resize to a geometry specification
--resize-method METHOD Set resizing method
--resize-colors N Resize can add new colors up to N
--transform-colormap CMD Transform each output colormap by shell CMD
--use-colormap CMAP Output GIF uses colors from CMAP, which can
be 'web', 'gray', 'bw', or a GIF file
--use-exact-colormap CMAP Same, but use CMAP as is (not a subset)
--gray Same as --use-colormap gray
Report bugs to <ekohler@gmail.com>.
Too much information? Try 'gifsicle --help | less'.
Options (70)
| Option | Description | Source |
|---|---|---|
-m, --merge | Combine all GIF inputs into one file with multiple frames and write that file to the standard output. | help + man |
-b, --batch | Modify each GIF input in place by reading and writing to the same filename. | help + man |
-e, --explode | Explode mode: write N files for each input, one per frame, to 'input.frame-number' | help + man |
-E, --explode-by-name | Same as --explode, but write any named frames to files ‘xxx.name’ instead of ‘xxx.frame-number’. | help + man |
-I, --info | Print a human-readable description of each input GIF to the standard output, or whatever file you specify with -o. | help + man |
--color-info, --cinfo | Like --info, but also print information about input files' colormaps. | help + man |
--extension-info, --xinfo | Like --info, but also print any unrecognized GIF extensions in a hexdump(1)-like format. | help + man |
--size-info, --sinfo | Like --info, but also print information about compressed image sizes. | help + man |
-V, --verbose | Print progress information (files read and written) to standard error. | help + man |
-h, --help | Print usage information and exit. | help + man |
--version | Print the version number and some short non-warranty information and exit. | help + man |
-o, --output FILE | Write output to FILE | help + man + man |
-w, --no-warnings | Suppress all warning messages. | help + man |
--no-ignore-errors | Exit with status 1 when encountering a very erroneous GIF. | help + man |
--max-screen WxH | Refuse to create logical screens larger than widthxheight. | help + man |
--conserve-memory | Conserve memory usage at the expense of processing time. | help + man |
--nextfile, --multifile | Like --nextfile, but read as many GIF images as possible from each file. | help + man + man |
--delete FRAMES | Delete FRAMES from input | help |
--insert-before FRAME | Insert other-GIFs before frame in the input GIF. | help + man |
--append GIFS | Append other-GIFs to the input GIF. | help + man |
--replace FRAMES | Replace frames from the input GIF with other-GIFs. | help + man |
--done | Complete the current set of frame changes. | help + man |
-B, --background COL | Set the output GIF's background to color. | help + man + man |
--crop-transparency | Crop any transparent borders off the following input frames. | help + man |
--flip-horizontal, --flip-vertical | Flip the following frames horizontally or vertically. | help + man + man |
-i, --interlace | Turn interlacing on. | help + man + man |
-S, --logical-screen WxH | Set the output logical screen to widthxheight. | help + man + man |
-p, --position X | Set the following frames' positions to (x,y). | help + man + man |
--rotate-90, --rotate-180, --rotate-270, --no-rotate | Rotate the following frames by 90, 180, or 270 degrees. | help + man + man + man |
-t, --transparent COL | Make color transparent in the following frames. | help + man + man |
--app-extension N | Add an application extension named app-name and with the value extension to the output GIF. | help + man |
-c, --comment TEXT | Add a comment, text, to the output GIF. | help + man + man |
--extension N | Add an extension numbered number and with the value extension to the output GIF. | help + man |
-n, --name TEXT | Set the next frame's name to text. | help + man + man |
--no-comments, --no-names, --no-extensions | Remove comments (names, extensions) from input | help |
-d, --delay TIME | Set the delay between frames to time in hundredths of a second. | help + man + man |
-D, --disposal METHOD | Set the disposal method for the following frames to method. | help + man + man |
-l, --loopcount N | Set loop extension to N (default forever) | help |
-O, --optimize LEVEL | Optimize output GIFs | help |
-U, --unoptimize | Unoptimize GIF animations into an easy-to-edit form. | help + man + man |
-j, --threads THREADS | Use multiple threads to improve speed | help |
--careful | Write slightly larger GIFs that avoid bugs in some other GIF implementations. | help + man |
--change-color COL1 | Change color1 to color2 in the following input GIFs. | help + man |
-k, --colors N | Reduce the number of distinct colors in each output GIF to num or less. | help + man + man |
--color-method METHOD | Determine how a smaller colormap is chosen. | help + man |
-f, --dither | Dither image after changing colormap | help + man |
--gamma G | Set the color space/gamma correction to gamma, which can be a real number, ‘srgb’ (the default), or ‘oklab’. | help + man |
--lossy LOSSINESS | Alter image colors to shrink output file size at the cost of artifacts and noise | help |
--resize WxH | Resize the output GIF to the given width and height. | help + man |
--scale XFACTOR[xYFACTOR | Scale the output GIF by XFACTORxYFACTOR | help |
--resize-width W | Resize to width W and proportional height | help + man |
--resize-height H | Resize to a given width or height, preserving aspect ratio. | help + man |
--resize-fit WxH | Shrink to fit WxH, preserving aspect ratio | help + man |
--resize-touch WxH | Resize the output GIF to fit a rectangle with dimensions widthxheight. | help + man |
--resize-geometry GEOM | Resize to a geometry specification as used in ImageMagick and GraphicsMagick. | help + man |
--resize-method METHOD | Set the method used to resize images. | help + man |
--resize-colors N | Allow Gifsicle to add intermediate colors when resizing images. | help + man |
--transform-colormap CMD | Command should be a shell command that reads from standard input and writes to standard output. | help + man |
--use-colormap CMAP | Output GIF uses colors from CMAP, which can be 'web', 'gray', 'bw', or a GIF file | help + man |
--use-exact-colormap CMAP | Same as --use-colormap, but the output GIF will use colormap as is, rather than reordering it and dropping unused colors. | help + man |
--gray | Same as --use-colormap gray | help |
--crop x1 | (in the manual page but not in --help) | man |
-O1 | Store only the changed portion of each image. (in the manual page but not in --help) | man |
-O2 | Store only the changed portion of each image, and use transparency. (in the manual page but not in --help) | man |
-O3 | Try several optimization methods (usually slower, sometimes better results). (in the manual page but not in --help) | man |
-Okeep-empty | Preserve empty transparent frames (they are dropped by default). (in the manual page but not in --help) | man |
--resize-fit-width width | (in the manual page but not in --help) | man |
--resize-fit-height height | (in the manual page but not in --help) | man |
--resize-touch-width width | (in the manual page but not in --help) | man |
--resize-touch-height height | Like --resize-fit and --resize-touch, but constrains only one dimension. (in the manual page but not in --help) | man |
Examples (11) from the manual page, untested
gifsicle a.gif b.gif c.gif d.gif > anim.gif
First, let's create an animation, ‘anim.gif’:gifsicle --delay 50 a.gif b.gif c.gif d.gif > anim.gif
This animation will move very quickly: since we didn't specify a delay, a browser will cycle through the frames as fast as it can.gifsicle -d 50 --loop=3 a.gif b.gif c.gif d.gif > anim.gif
If we also want the GIF to loop three times, we can use --loopcount:gifsicle --explode anim.gif
To explode ‘anim.gif’ into its component frames:gifsicle -b -O2 anim.gif
To optimize ‘anim.gif’:gifsicle -b --unoptimize -O2 anim.gif --replace "#1" x.gif
To change the second frame of ‘anim.gif’ to ‘x.gif’:gifsicle -I "#0" "#3" < anim.gif
To print information about the first and fourth frames of ‘anim.gif’:gifsicle -bII --trans "#000000" *.gif
To make black the transparent color in all the GIFs in the current directory, and also print information about each:gifsicle -b --colors=64 --use-col=web anim.gif
To change ‘anim.gif’ to use a 64-color subset of the Web-safe palette:gifsicle --dither --use-col=bw anim.gif > anim-bw.gif
To make a dithered black-and-white version of ‘anim.gif’:gifsicle bottom.gif top.gif | gifsicle -U "#1" > result.gif
To overlay one GIF atop another -- producing a one-frame output GIF that looks like the superposition of the two inputs -- use gifsicle twice: