1GIFSICLE(1) General Commands Manual GIFSICLE(1)
2
3
4
6 gifsicle - manipulates GIF images and animations
7
9 gifsicle [options, frames, and filenames]...
10
12 gifsicle is a powerful command-line program for creating, editing,
13 manipulating, and getting information about GIF images and animations.
14
15 Gifsicle normally processes input GIF files according to its command
16 line options and writes the result to the standard output. The -i
17 option, for example, tells gifsicle to interlace its inputs:
18
19 gifsicle -i < pic.gif > interlaced-pic.gif
20
21 Gifsicle is good at creating and manipulating GIF animations. By
22 default, it combines two or more input files into a “flipbook” anima‐
23 tion:
24
25 gifsicle pic1.gif pic2.gif pic3.gif > animation.gif
26
27 Use options like --delay, --loopcount, and --optimize to tune your ani‐
28 mations.
29
30 To modify GIF files in place, use the --batch option. With --batch,
31 gifsicle will modify the files you specify instead of writing a new
32 file to the standard output. To interlace all the GIFs in the current
33 directory, you could say:
34
35 gifsicle --batch -i *.gif
36
37 New users may want to skip to the Examples section at the end.
38
40 Concepts are on the left, relevant gifsicle options are on the right.
41
42 Animations, changing frame selections, frame changes, etc.
43 disposal --disposal
44 looping --loopcount
45 portions of frame selections
46 smaller --optimize, --colors, --lossy
47 speed --delay
48 Bad output --careful
49 Background color --background
50 Colors, changing --change-color, --use-colormap, --dither,
51 --transform-colormap
52 reducing number --colors, --dither, --gamma
53 Comments --comment
54 Extensions --extension, --app-extension, --extension-info
55 File size --optimize, --unoptimize, --colors, --lossy
56 Image transformations
57 cropping --crop, --crop-transparency
58 flipping --flip-*
59 resizing --resize, --scale
60 rotating --rotate-*
61 Grayscale --use-colormap
62 Interlacing --interlace
63 Positioning frames --position
64 Screen, logical --logical-screen
65 Selecting frames frame selections (like '#0')
66 Transparency --transparent
67 Warnings --no-warnings
68
70 gifsicle's command line consists of GIF input files and options. Most
71 options start with a dash (-) or plus (+); frame selections, a kind of
72 option, start with a number sign (#). Anything else is a GIF input
73 file.
74
75 gifsicle reads and processes GIF input files in order. If no GIF input
76 file is given, or you give the special filename ‘-’, it reads from the
77 standard input.
78
79 gifsicle exits with status 0 if there were no errors and status 1 oth‐
80 erwise.
81
83 Every option has a long form, ‘--long-descriptive-name’. You don't
84 need to type the whole long descriptive name, just enough to make it
85 unambiguous.
86
87 Some options also have a short form, ‘-X’. You can combine short op‐
88 tions if they don't take arguments: ‘-IIb’ is the same as ‘-I -I -b’.
89 But be careful with options that do take arguments: ‘-cblah’ means ‘-c
90 blah’, not ‘-c -b -l -a -h’.
91
92 Many options also have a converse, ‘--no-option’, which turns off the
93 option. You can turn off a short option ‘-X’ by saying ‘+X’ instead.
94
95 Mode Options
96 Mode options tell gifsicle what kind of output to generate. There can
97 be at most one, and it must precede any GIF inputs.
98
99 --merge, -m
100 Combine all GIF inputs into one file with multiple frames and
101 write that file to the standard output. This is the default mode.
102
103 --batch, -b
104 Modify each GIF input in place by reading and writing to the same
105 filename. (GIFs read from the standard input are written to the
106 standard output.)
107
108 --explode, -e
109 Create an output GIF for each frame of each input file. The output
110 GIFs are named ‘xxx.000’, ‘xxx.001’, and so on, where ‘xxx’ is the
111 name of the input file (or whatever you specified with ‘--output’)
112 and the numeric extension is the frame number.
113
114 --explode-by-name, -E
115 Same as --explode, but write any named frames to files ‘xxx.name’
116 instead of ‘xxx.frame-number’. Frames are named using the
117 ‘--name’ option.
118
119 General Options
120 General options control the information gifsicle prints and where it
121 writes its output. The info options and --verbose can be turned off
122 with ‘--no-X’.
123
124 --info, -I
125 Print a human-readable description of each input GIF to the stan‐
126 dard output, or whatever file you specify with -o. This option
127 suppresses normal output, and cannot be combined with mode options
128 like --batch. If you give two --info or -I options, however, in‐
129 formation is printed to standard error, and normal output takes
130 place as usual.
131
132 --color-info, --cinfo
133 Like --info, but also print information about input files' col‐
134 ormaps.
135
136 --extension-info, --xinfo
137 Like --info, but also print any unrecognized GIF extensions in a
138 hexdump(1)-like format.
139
140 --size-info, --sinfo
141 Like --info, but also print information about compressed image
142 sizes.
143
144 --help, -h
145 Print usage information and exit.
146
147 -o file
148 --output file
149 Send output to file. The special filename ‘-’ means the standard
150 output.
151
152 --verbose, -V
153 Print progress information (files read and written) to standard
154 error.
155
156 --no-warnings, -w
157 Suppress all warning messages.
158
159 --no-ignore-errors
160 Exit with status 1 when encountering a very erroneous GIF. Default
161 is to muddle on.
162
163 --version
164 Print the version number and some short non-warranty information
165 and exit.
166
167 --careful
168 Write slightly larger GIFs that avoid bugs in some other GIF im‐
169 plementations. Some Java and Internet Explorer versions cannot
170 display the correct, minimal GIFs that Gifsicle produces. Use the
171 --careful option if you are having problems with a particular im‐
172 age.
173
174 --conserve-memory
175 Conserve memory usage at the expense of processing time. This may
176 be useful if you are processing large GIFs on a computer without
177 very much memory. Or say --no-conserve-memory.
178
179 --nextfile
180 Allow input files to contain multiple concatenated GIF images. If
181 a filename appears multiple times on the command line, gifsicle
182 will read a new image from the file each time. This option can
183 help scripts avoid the need for temporary files. For example, to
184 create an animated GIF with three frames with different delays,
185 you might run "gifsicle --nextfile -d10 - -d20 - -d30 - > out.gif"
186 and write the three GIF images, in sequence, to gifsicle's stan‐
187 dard input.
188
189 --multifile
190 Like --nextfile, but read as many GIF images as possible from each
191 file. This option is intended for scripts. For example, to merge
192 an unknown number of GIF images into a single animation, run "gif‐
193 sicle --multifile - > out.gif" and write the GIF images, in se‐
194 quence, to gifsicle's standard input. Any frame selections apply
195 only to the last file in the concatenation.
196
197 Frame Selections
198 A frame selection tells gifsicle which frames to use from the current
199 input file. They are useful only for animations, as non-animated GIFs
200 only have one frame. Here are the acceptable forms for frame specifica‐
201 tions.
202
203 #num Select frame num. (The first frame is ‘#0’. Negative num‐
204 bers count backwards from the last frame, which is ‘#-1’.)
205 #num1-num2 Select frames num1 through num2.
206 #num1- Select frames num1 through the last frame.
207 #name Select the frame named name.
208
209 The ‘#’ character has special meaning for many shells, so you generally
210 need to quote it.
211
212 For example,
213 gifsicle happy.gif "#0"
214 uses the first frame from happy.gif;
215 gifsicle happy.gif "#0-2"
216 uses its first three frames; and
217 gifsicle happy.gif "#-1-0"
218 uses its frames in reverse order (starting from frame #-1 -- the last
219 frame -- and ending at frame #0 -- the first).
220
221 The action performed with the selected frames depends on the current
222 mode. In merge mode, only the selected frames are merged into the out‐
223 put GIF. In batch mode, only the selected frames are modified; other
224 frames remain unchanged. In explode mode, only the selected frames are
225 exploded into output GIFs.
226
227 Frame Change Options
228 Frame change options insert new frames into an animation or replace or
229 delete frames that already exist. Some things -- for example, changing
230 one frame in an animation -- are difficult to express with frame selec‐
231 tions, but easy with frame changes.
232
233 --delete frames [frames...]
234 Delete frames from the input GIF.
235
236 --insert-before frame other-GIFs
237 Insert other-GIFs before frame in the input GIF.
238
239 --append other-GIFs
240 Append other-GIFs to the input GIF.
241
242 --replace frames other-GIFs
243 Replace frames from the input GIF with other-GIFs.
244
245 --done
246 Complete the current set of frame changes.
247
248 The frames arguments are frame selections (see above). These arguments
249 always refer to frames from the original input GIF. So, if ‘a.gif’ has
250 3 frames and ‘b.gif’ has one, this command
251 gifsicle a.gif --delete "#0" --replace "#2" b.gif
252 will produce an output animation with 2 frames: ‘a.gif’ frame 1, then
253 ‘b.gif’.
254
255 The other-GIFs arguments are any number of GIF input files and frame
256 selections. These images are combined in merge mode and added to the
257 input GIF. The other-GIFs last until the next frame change option, so
258 this command replaces the first frame of ‘in.gif’ with the merge of
259 ‘a.gif’ and ‘b.gif’:
260 gifsicle -b in.gif --replace "#0" a.gif b.gif
261
262 This command, however, replaces the first frame of ‘in.gif’ with
263 ‘a.gif’ and then processes ‘b.gif’ separately:
264 gifsicle -b in.gif --replace "#0" a.gif --done b.gif
265
266 Warning: You shouldn't use both frame selections and frame changes on
267 the same input GIF.
268
269 Image Options
270 Image options modify input images -- by changing their interlacing,
271 transparency, and cropping, for example. Image options have three
272 forms: ‘--X’, ‘--no-X’, and ‘--same-X’. The ‘--X’ form selects a value
273 for the feature, the ‘--no-X’ form turns off the feature, and the
274 ‘--same-X’ form means that the feature's value is copied from each in‐
275 put. The default is always ‘--same-X’. For example, -back‐
276 ground="#0000FF" sets the background color to blue, --no-background
277 turns the background color off (by setting it to 0), and --same-back‐
278 ground uses input images' existing background colors. You can give each
279 option multiple times; for example,
280 gifsicle -b -O2 -i a.gif --same-interlace b.gif c.gif
281 will make ‘a.gif’ interlaced, but leave ‘b.gif’ and ‘c.gif’ interlaced
282 only if they were already.
283
284 -B color
285 --background color
286 Set the output GIF's background to color. The argument can have
287 the same forms as in the --transparent option below.
288
289 --crop x1,y1-x2,y2
290 --crop x1,y1+widthxheight
291 Crop the following input frames to a smaller rectangular area. The
292 top-left corner of this rectangle is (x1,y1); you can give either
293 the lower-right corner, (x2,y2), or the width and height of the
294 rectangle. In the x1,y1+widthxheight form, width and height can be
295 zero or negative. A zero dimension means the cropping area goes to
296 the edge of the image; a negative dimension brings the cropping
297 area that many pixels back from the image edge. For example,
298 --crop 2,2+-2x-2 will shave 2 pixels off each side of the input
299 image. Cropping takes place before any rotation, flipping, resiz‐
300 ing, or positioning.
301
302 --crop-transparency
303 Crop any transparent borders off the following input frames. This
304 happens after any cropping due to the --crop option. It works on
305 the raw input images; for example, any transparency options have
306 not yet been applied.
307
308 --flip-horizontal
309 --flip-vertical
310 Flip the following frames horizontally or vertically.
311
312 -i
313 --interlace
314 Turn interlacing on.
315
316 -S widthxheight
317 --logical-screen widthxheight
318 Set the output logical screen to widthxheight. --no-logi‐
319 cal-screen sets the output logical screen to the size of the
320 largest output frame, while --same-logical-screen sets the output
321 logical screen to the largest input logical screen. --screen is a
322 synonym for --logical-screen.
323
324 -p x,y
325 --position x,y
326 Set the following frames' positions to (x,y). --no-position means
327 --position 0,0. Normally, --position x,y places every succeeding
328 frame exactly at x,y. However, if an entire animation is input,
329 x,y is treated as the position for the animation.
330
331 --rotate-90
332 --rotate-180
333 --rotate-270
334 Rotate the following frames by 90, 180, or 270 degrees. --no-ro‐
335 tate turns off any rotation.
336
337 -t color
338 --transparent color
339 Make color transparent in the following frames. Color can be a
340 colormap index (0-255), a hexadecimal color specification (like
341 "#FF00FF" for magenta), or slash- or comma-separated red, green
342 and blue values (each between 0 and 255).
343
344 Extension Options
345 Extension options add non-visual information to the output GIF. This
346 includes names, comments, and generic extensions.
347
348 --app-extension app-name extension
349 Add an application extension named app-name and with the value ex‐
350 tension to the output GIF. --no-app-extensions removes applica‐
351 tion extensions from the input images.
352
353 -c text
354 --comment text
355 Add a comment, text, to the output GIF. The comment will be placed
356 before the next frame in the stream. --no-comments removes com‐
357 ments from the input images.
358
359 --extension number extension
360 Add an extension numbered number and with the value extension to
361 the output GIF. Number can be in decimal, octal, hex, or it can
362 be a single character like ‘n’, whose ASCII value is used.
363 --no-extensions (or +x) removes extensions from the input images.
364
365 -n text
366 --name text
367 Set the next frame's name to text. This name is stored as an ex‐
368 tension in the output GIF (extension number 0xCE, followed by the
369 characters of the frame name). --no-names removes name extensions
370 from the input images.
371
372 Animation Options
373 Animation options apply to GIF animations, or to individual frames in
374 GIF animations. As with image options, most animation options have
375 three forms, ‘--X’, ‘--no-X’, and ‘--same-X’, and you can give anima‐
376 tion options multiple times; for example,
377 gifsicle -b a.gif -d50 "#0" "#1" -d100 "#2" "#3"
378 sets the delays of frames 0 and 1 to 50, and frames 2 and 3 to 100.
379
380 -d time
381 --delay time
382 Set the delay between frames to time in hundredths of a second.
383
384 -D method
385 --disposal method
386 Set the disposal method for the following frames to method. A
387 frame's disposal method determines how a viewer should remove the
388 frame when it's time to display the next. Method can be a number
389 between 0 and 7 (although only 0 through 3 are generally meaning‐
390 ful), or one of these names: none (leave the frame visible for fu‐
391 ture frames to build upon), asis (same as "none"), background (or
392 bg) (replace the frame with the background), or previous (replace
393 the frame with the area from the previous displayed frame).
394 --no-disposal means --disposal=none.
395
396 -l[count]
397 --loopcount[=count]
398 Set the Netscape loop extension to count. Count is an integer, or
399 forever to loop endlessly. If you supply a --loopcount option
400 without specifying count, Gifsicle will use forever. --no-loop‐
401 count (the default) turns off looping.
402
403 Set the loop count to one less than the number of times you want
404 the animation to run. An animation with --no-loopcount will show
405 every frame once; --loopcount=1 will loop once, thus showing every
406 frame twice; and so forth. Note that --loopcount=0 is equivalent
407 to --loopcount=forever, not --no-loopcount.
408
409 -O[level]
410 --optimize[=level]
411 Optimize output GIF animations for space. Level determines how
412 much optimization is done; higher levels take longer, but may have
413 better results. There are currently three levels:
414
415 -O1 Stores only the changed portion of each image. This is the
416 default.
417 -O2 Also uses transparency to shrink the file further.
418 -O3 Try several optimization methods (usually slower, sometimes
419 better results).
420
421 Other optimization flags provide finer-grained control.
422
423 -Okeep-empty
424 Preserve empty transparent frames (they are dropped by de‐
425 fault).
426
427 You may also be interested in other options for shrinking GIFs,
428 such as -k, --lossy, and --no-extensions.
429
430 -U
431 --unoptimize
432 Unoptimize GIF animations into an easy-to-edit form.
433
434 GIF animations are often optimized (see --optimize) to make them
435 smaller and faster to load, which unfortunately makes them diffi‐
436 cult to edit. --unoptimize changes optimized input GIFs into un‐
437 optimized GIFs, where each frame is a faithful representation of
438 what a user would see at that point in the animation.
439
440 Image Transformation Options
441 Image transformation options apply to entire GIFs as they are read or
442 written. They can be turned off with ‘--no-option’.
443
444 --resize widthxheight
445 Resize the output GIF to the given width and height. If width or
446 height is an underscore ‘_’, that dimension is chosen so that the
447 aspect ratio remains unchanged. Resizing happens after all input
448 frames have been combined and before optimization. Resizing uses
449 logical screen dimensions; if the input stream has an unusual log‐
450 ical screen (many GIF displayers ignore logical screens), you may
451 want to provide --no-logical-screen (or +S) to reset it so gifsi‐
452 cle uses image dimensions instead. See also --resize-method.
453
454 --resize-width width
455 --resize-height height
456 Resize to a given width or height, preserving aspect ratio. Equiv‐
457 alent to --resize widthx_ or --resize _xheight.
458
459 --resize-fit widthxheight
460 --resize-touch widthxheight
461 Resize the output GIF to fit within a rectangle with dimensions
462 widthxheight. The aspect ratio remains unchanged. The --re‐
463 size-fit option only shrinks the image—no resize is performed if
464 the GIF already fits within the rectangle. Either width or height
465 may be an underscore ‘_’, which leaves that dimension uncon‐
466 strained.
467
468 --resize-fit-width width
469 --resize-fit-height height
470 --resize-touch-width width
471 --resize-touch-height height
472 Like --resize-fit and --resize-touch, but constrains only one di‐
473 mension.
474
475 --scale Xfactor[xYfactor]
476 Scale the output GIF's width and height by Xfactor and Yfactor.
477 If Yfactor is not given, it defaults to Xfactor. Scaling happens
478 after all input frames have been combined and before optimization.
479
480 --resize-method method
481 Set the method used to resize images. The ‘sample’ method runs
482 very quickly, but when shrinking images, it produces noisy re‐
483 sults. The ‘mix’ method is somewhat slower, but produces better-
484 looking results. The default method is currently ‘mix’.
485
486 Details: The resize methods differ most when shrinking images. The
487 ‘sample’ method is a point sampler: each pixel position in the
488 output image maps to exactly one pixel position in the input. When
489 shrinking, full rows and columns from the input are dropped. The
490 other methods use all input pixels, which generally produces bet‐
491 ter-looking images. The ‘box’ method, a box sampler, is faster
492 than the more complex filters and produces somewhat sharper re‐
493 sults, but there will be anomalies when shrinking images by a
494 small amount in one dimension. (Some output pixels will corre‐
495 spond to exactly 1 input row or column, while others will corre‐
496 spond to exactly 2 input rows or columns.) The ‘mix’ method is a
497 full bilinear interpolator. This is slower and produces somewhat
498 blurrier results, but avoids anomalies.
499
500 Gifsicle also supports more complex resamplers, including Catmull-
501 Rom cubic resampling (‘catrom’), the Mitchell-Netravali filter
502 (‘mitchell’), a 2-lobed Lanczos filter (‘lanczos2’), and a 3-lobed
503 Lanczos filter (‘lanczos3’). These filters are slower still, but
504 can give sharper, better results.
505
506 --resize-colors n
507 Allow Gifsicle to add intermediate colors when resizing images.
508 Normally, Gifsicle's resize algorithms use input images' color
509 palettes without changes. When shrinking images with very few col‐
510 ors (e.g., pure black-and-white images), adding intermediate col‐
511 ors can improve the results. Example: --resize-colors 64 allows
512 Gifsicle to add intermediate colors for images that have fewer
513 than 64 input colors.
514
515 Color Options
516 Color options apply to entire GIFs as they are read or written. They
517 can be turned off with ‘--no-option’.
518
519 -k num
520 --colors num
521 Reduce the number of distinct colors in each output GIF to num or
522 less. Num must be between 2 and 256. This can be used to shrink
523 output GIFs or eliminate any local color tables.
524
525 Normally, an adaptive group of colors is chosen from the existing
526 color table. You can affect this process with the --color-method
527 option or by giving your own colormap with --use-colormap. Gifsi‐
528 cle may need to add an additional color (making num+1 in all) if
529 there is transparency in the image.
530
531 --color-method method
532 Determine how a smaller colormap is chosen. ‘diversity’, the de‐
533 fault, is xv(1)'s diversity algorithm, which uses a strict subset
534 of the existing colors and generally produces good results.
535 ‘blend-diversity’ is a modification of this: some color values are
536 blended from groups of existing colors. ‘median-cut’ is the medi‐
537 an cut algorithm described by Heckbert. --method is a synonym for
538 --color-method.
539
540 -f
541 --dither[=method]
542 When --dither is on and the colormap is changed, combinations of
543 colors are used to approximate missing colors. This looks better,
544 but makes bigger files and can cause animation artifacts, so it is
545 off by default.
546
547 Specify a dithering algorithm with the optional method argument.
548 The default, ‘floyd-steinberg’, uses Floyd-Steinberg error diffu‐
549 sion. This usually looks best, but can cause animation artifacts,
550 because dithering choices will vary from frame to frame. Gifsicle
551 also supports ordered dithering algorithms that avoid animation
552 artifacts. The ‘ro64’ mode uses a large, random-looking pattern
553 and generally produces good results. The ‘o3’, ‘o4’, and ‘o8’
554 modes use smaller, more regular patterns. The ‘ordered’ mode
555 chooses a good ordered dithering algorithm. For special effects,
556 try the halftone modes ‘halftone’, ‘squarehalftone’, and ‘diago‐
557 nal’. Some modes take optional parameters using commas. The
558 halftone modes take a cell size and a color limit: ‘halftone,10,3’
559 creates 10-pixel wide halftone cells where each cell uses up to 3
560 colors.
561
562 --gamma gamma
563 Set the gamma correction to gamma, which can be a real number or
564 ‘srgb’. Roughly speaking, higher numbers exaggerate shadows and
565 lower numbers exaggerate highlights. The default is the function
566 defined by the standard sRGB color space, which usually works
567 well. (Its effects are similar to --gamma=2.2.) Gifsicle uses gam‐
568 ma correction when choosing a color palette (--colors) and when
569 dithering (--dither).
570
571 --lossy[=lossiness]
572 Alter image colors to shrink output file size at the cost of arti‐
573 facts and noise. Lossiness determines how many artifacts are al‐
574 lowed; higher values can result in smaller file sizes, but cause
575 more artifacts. The default lossiness is 20.
576
577 --change-color color1 color2
578 Change color1 to color2 in the following input GIFs. (The color
579 arguments have the same forms as in the -t option.) Change multi‐
580 ple colors by giving the option multiple times. Color changes
581 don't interfere with one another, so you can safely swap two col‐
582 ors with ‘--change-color color1 color2 --change-color color2 col‐
583 or1’. They all take effect as an input GIF is read.
584 --no-change-color cancels all color changes.
585
586 --transform-colormap command
587 Command should be a shell command that reads from standard input
588 and writes to standard output. Each colormap in the output GIF is
589 translated into text colormap format (see --use-colormap below)
590 and piped to the command. The output that command generates (which
591 should also be in text colormap format) will replace the input
592 colormap. The replacement doesn't consider color matching, so pix‐
593 els that used color slot n in the input will still use color slot
594 n in the output.
595
596 --use-colormap colormap
597 Change the image to use colormap. Each pixel in the image is
598 changed to the closest match in colormap (or, if --dither is on,
599 to a dithered combination of colors in colormap). Colormap can be
600 web for the 216-color “Web-safe palette”; gray for grayscale; bw
601 for black-and-white; or the name of a file. That file should ei‐
602 ther be a text file (the format is described below) or a GIF file,
603 whose global colormap will be used. If --colors=N is also given,
604 an N-sized subset of colormap will be used.
605
606 Text colormap files use this format:
607
608 ; each non-comment line represents one color, "red green blue"
609 ; each component should be between 0 and 255
610 0 0 0 ; like this
611 255 255 255
612 ; or use web hex notation
613 #ffffff ; like this
615 First, let's create an animation, ‘anim.gif’:
616
617 gifsicle a.gif b.gif c.gif d.gif > anim.gif
618
619 This animation will move very quickly: since we didn't specify a delay,
620 a browser will cycle through the frames as fast as it can. Let's slow
621 it down and pause .5 seconds between frames, using the --delay option.
622
623 gifsicle --delay 50 a.gif b.gif c.gif d.gif > anim.gif
624
625 If we also want the GIF to loop three times, we can use --loopcount:
626
627 gifsicle -d 50 --loop=3 a.gif b.gif c.gif d.gif > anim.gif
628
629 (Rather than type --delay again, we used its short form, -d. Many op‐
630 tions have short forms; you can see them by running ‘gifsicle --help’.
631 We also abbreviated --loopcount to --loop, which is OK since no other
632 option starts with ‘loop’.)
633
634 To explode ‘anim.gif’ into its component frames:
635
636 gifsicle --explode anim.gif
637 ls anim.gif*
638 anim.gif anim.gif.000 anim.gif.001 anim.gif.002 anim.gif.003
639
640 To optimize ‘anim.gif’:
641
642 gifsicle -b -O2 anim.gif
643
644 To change the second frame of ‘anim.gif’ to ‘x.gif’:
645
646 gifsicle -b --unoptimize -O2 anim.gif --replace "#1" x.gif
647
648 --unoptimize is used since ‘anim.gif’ was optimized in the last step.
649 Editing individual frames in optimized GIFs is dangerous without --un‐
650 optimize; frames following the changed frame could be corrupted by the
651 change. Of course, this might be what you want.
652
653 Note that --unoptimize and --optimize can be on simultaneously. --un‐
654 optimize affects input GIF files, while --optimize affects output GIF
655 files.
656
657 To print information about the first and fourth frames of ‘anim.gif’:
658
659 gifsicle -I "#0" "#3" < anim.gif
660
661 To make black the transparent color in all the GIFs in the current di‐
662 rectory, and also print information about each:
663
664 gifsicle -bII --trans "#000000" *.gif
665
666 Giving -I twice forces normal output to occur. With only one -I, the
667 GIFs would not be modified.
668
669 To change ‘anim.gif’ to use a 64-color subset of the Web-safe palette:
670
671 gifsicle -b --colors=64 --use-col=web anim.gif
672
673 To make a dithered black-and-white version of ‘anim.gif’:
674
675 gifsicle --dither --use-col=bw anim.gif > anim-bw.gif
676
677 To overlay one GIF atop another -- producing a one-frame output GIF
678 that looks like the superposition of the two inputs -- use gifsicle
679 twice:
680
681 gifsicle bottom.gif top.gif | gifsicle -U "#1" > result.gif
682
684 Some optimized output GIFs may appear incorrectly on some GIF implemen‐
685 tations (for example, Java's); see the --careful option.
686
687 Please email suggestions, additions, patches and bugs to
688 ekohler@gmail.com.
689
691 For a tutorial on GIF images and animations, you might try some of the
692 resources listed on-line at webreference.com:
693 http://www.webreference.com/authoring/graphics/animation.html
694
696 Eddie Kohler <ekohler@gmail.com>
697 http://www.read.seas.harvard.edu/~kohler/
698 He wrote it.
699
700 Anne Dudfield <annied@frii.com>
701 http://www.frii.com/~annied/
702 She named it.
703
704 Hans Dinsen-Hansen <dino@danbbs.dk>
705 http://www.danbbs.dk/~dino/
706 Adaptive tree method for GIF writing.
707
708 Kornel Lesinski
709 --lossy option.
710
711 http://www.lcdf.org/gifsicle/
712 The gifsicle home page.
713
714
715
716Version 1.92 11 July 2017 GIFSICLE(1)