### Select frames from a GIF Source: http://www.lcdf.org/gifsicle/man.html Examples of using frame selection syntax to extract specific frames or ranges from an animated GIF. ```bash gifsicle happy.gif "#0" ``` ```bash gifsicle happy.gif "#0-2" ``` ```bash gifsicle happy.gif "#-1-0" ``` -------------------------------- ### Create a Basic Animation Source: http://www.lcdf.org/gifsicle/man.html Combines multiple GIF files (a.gif, b.gif, c.gif, d.gif) into a single animation file named anim.gif. Without specified delay, frames cycle as fast as possible. ```bash gifsicle a.gif b.gif c.gif d.gif > anim.gif ``` -------------------------------- ### Create Looping Animation with Short Options Source: http://www.lcdf.org/gifsicle/man.html Creates a looping animation 'anim.gif' with a frame delay of 50 units and configured to loop 3 times. Uses short forms for options. ```bash gifsicle -d 50 --loop=3 a.gif b.gif c.gif d.gif > anim.gif ``` -------------------------------- ### Apply Interlacing Options Source: http://www.lcdf.org/gifsicle/man.html Demonstrates using the --same-interlace option to conditionally apply interlacing based on the input file's existing state. ```bash gifsicle -b -O2 -i a.gif --same-interlace b.gif c.gif ``` -------------------------------- ### Create Dithered Black-and-White Version Source: http://www.lcdf.org/gifsicle/man.html Creates a dithered black-and-white version of 'anim.gif', saving the output to 'anim-bw.gif'. ```bash gifsicle --dither --use-col=bw anim.gif > anim-bw.gif ``` -------------------------------- ### Create GIF Animation with Gifsicle Source: http://www.lcdf.org/gifsicle/index.html Use this command to create a GIF animation from a sequence of existing GIF files. Specify the delay between frames and whether the animation should loop. ```bash gifsicle --delay=10 --loop *.gif > anim.gif ``` -------------------------------- ### Create Animation with Frame Delay Source: http://www.lcdf.org/gifsicle/man.html Creates an animation file 'anim.gif' from input GIFs, setting a delay of 50 units (e.g., centiseconds) between frames. ```bash gifsicle --delay 50 a.gif b.gif c.gif d.gif > anim.gif ``` -------------------------------- ### Gamma and Lossy Compression Options Source: http://www.lcdf.org/gifsicle/man.html Options for adjusting color space/gamma correction and applying lossy compression for file size reduction. ```APIDOC ## Gamma and Lossy Compression Options ### Description Options to adjust the color space and apply lossy compression to reduce file size, potentially at the cost of image quality. ### Options - **--gamma** _gamma_ Set the color space/gamma correction. _gamma_ can be a real number, `srgb` (default), or `oklab`. Higher numbers exaggerate shadows, lower numbers exaggerate highlights. Gifsicle uses this setting for color palette selection, dithering, and lossy compression artifact evaluation. - **--lossy**[=_lossiness_] Alter image colors to shrink file size by introducing artifacts and noise. _Lossiness_ determines the amount of allowed artifacts; higher values can result in smaller files but more artifacts. The default _lossiness_ is 20. The color space set by `--gamma` is used to evaluate artifacts. ``` -------------------------------- ### Set Transparent Color and Print Info Source: http://www.lcdf.org/gifsicle/man.html Makes black (#000000) the transparent color for all GIF files in the current directory and prints information about each modified GIF. The -b flag modifies files in place, and -II forces normal output. ```bash gifsicle -bII --trans "#000000" *.gif ``` -------------------------------- ### Optimize GIF Animation File Size Source: http://www.lcdf.org/gifsicle/man.html Attempts to reduce GIF animation file sizes. Higher levels may take longer but yield better results. Level 1 is default, Level 2 uses transparency, and Level 3 tries multiple methods. ```bash gifsicle --optimize=1 a.gif ``` ```bash gifsicle --optimize=2 a.gif ``` ```bash gifsicle --optimize=3 a.gif ``` -------------------------------- ### Optimize Animation with Level 2 Source: http://www.lcdf.org/gifsicle/man.html Optimizes the animation file 'anim.gif' using optimization level 2. The -b flag indicates that the output should overwrite the input file. ```bash gifsicle -b -O2 anim.gif ``` -------------------------------- ### Optimization Source: http://www.lcdf.org/gifsicle/man.html Attempts to shrink the file sizes of GIF animations using various optimization levels. ```APIDOC ## Optimization ### Description Attempt to shrink the file sizes of GIF animations. _Level_ determines how much optimization is done; higher levels take longer, but may have better results. There are currently three levels: * **-O1**: Store only the changed portion of each image. This is the default. * **-O2**: Store only the changed portion of each image, and use transparency. * **-O3**: Try several optimization methods (usually slower, sometimes better results). Other optimization flags provide finer-grained control. **-Okeep-empty**: Preserve empty transparent frames (they are dropped by default). You may also be interested in other options for shrinking GIFs, such as **-k** , **--lossy** , and **--no-extensions**. Note that **-O** does not guarantee to shrink file size, and in rare cases, even **-O3** may actually enlarge file size. ### Method **-O**[_level_] **--optimize**[=_level_] ``` -------------------------------- ### Print Information About Specific Frames Source: http://www.lcdf.org/gifsicle/man.html Prints detailed information about the first frame (index #0) and the fourth frame (index #3) of the 'anim.gif' animation. Input is piped to gifsicle. ```bash gifsicle -I "#0" "#3" < anim.gif ``` -------------------------------- ### Loop Count Source: http://www.lcdf.org/gifsicle/man.html Configures the Netscape loop extension for GIF animations. ```APIDOC ## Loop Count ### Description Set the Netscape loop extension to _count_. _Count_ is an integer, or **forever** to loop endlessly. If you supply a **--loopcount** option without specifying _count_ , Gifsicle will use **forever**. **--no-loopcount** (the default) turns off looping. Set the loop count to one less than the number of times you want the animation to run. An animation with **--no-loopcount** will show every frame once; **--loopcount** =1 will loop once, thus showing every frame twice; and so forth. Note that **--loopcount** =0 is equivalent to **--loopcount** =forever, not **--no-loopcount**. ### Method **-l**[_count_] **--loopcount**[=_count_] ``` -------------------------------- ### Unoptimize Source: http://www.lcdf.org/gifsicle/man.html Converts optimized GIF animations into an easier-to-edit, unoptimized form. ```APIDOC ## Unoptimize ### Description Unoptimize GIF animations into an easy-to-edit form. GIF animations are often optimized (see **--optimize**) to make them smaller and faster to load, which unfortunately makes them difficult to edit. **--unoptimize** changes optimized input GIFs into unoptimized GIFs, where each frame is a faithful representation of what a user would see at that point in the animation. ### Method **-U** **--unoptimize** ``` -------------------------------- ### Unoptimize GIF Animation Source: http://www.lcdf.org/gifsicle/man.html Converts optimized GIF animations into an unoptimized format, making each frame a complete representation for easier editing. ```bash gifsicle --unoptimize a.gif ``` -------------------------------- ### Replace Frames with Gifsicle Source: http://www.lcdf.org/gifsicle/man.html Use the --replace option to substitute existing frames with frames from other GIFs. Multiple GIFs can be merged into the replacement. ```bash gifsicle -b in.gif --replace "#0" a.gif b.gif ``` ```bash gifsicle -b in.gif --replace "#0" a.gif --done b.gif ``` -------------------------------- ### Color Reduction and Colormap Options Source: http://www.lcdf.org/gifsicle/man.html Options to control the number of colors and how the colormap is chosen. ```APIDOC ## Color Reduction and Colormap Options ### Description Options to control the number of distinct colors in the output GIF and the method used for choosing a smaller colormap. ### Options - **-k** _num_, **--colors** _num_ Reduce the number of distinct colors in each output GIF to _num_ or less (2-256). This can shrink GIFs or eliminate local color tables. Gifsicle may add an extra color if transparency is present. - **--color-method** _method_ Determine how a smaller colormap is chosen. Supported methods include: - `diversity` (default): xv(1)'s diversity algorithm. - `blend-diversity`: A modification of diversity where some color values are blended. - `median-cut`: Heckbert's median cut algorithm. - `**--method**` is a synonym for `--color-method`. - **--use-colormap** _colormap_ Use a specified colormap. (Details on colormap format are typically found elsewhere, e.g., in `--transform-colormap` description). ``` -------------------------------- ### Dithering Options Source: http://www.lcdf.org/gifsicle/man.html Options to control dithering, which approximates missing colors using combinations of available colors. ```APIDOC ## Dithering Options ### Description Options to enable and configure dithering, which uses combinations of colors to approximate missing colors when the colormap is changed. Dithering can improve visual quality but may increase file size and cause animation artifacts. ### Options - **-f**, **--dither**[=_method_] Enable dithering. An optional _method_ argument can specify the dithering algorithm: - `floyd-steinberg` (default): Floyd-Steinberg error diffusion. Can cause frame-to-frame animation artifacts. - `atkinson`: Atkinson error diffusion, a variant of Floyd-Steinberg with a more localized pattern. - `ro64`: Ordered dithering with a large, random-looking pattern. - `o3`, `o4`, `o8`: Ordered dithering with smaller, more regular patterns. - `ordered`: Selects a good ordered dithering algorithm. - `halftone`, `squarehalftone`, `diagonal`: Halftone methods for special effects. Some methods, like halftone, accept optional parameters using commas (e.g., `halftone,10,3` for 10-pixel cells and 3 colors per cell). - **--no-dither** Disable dithering (this is the default behavior). ``` -------------------------------- ### Set Frame Disposal Method Source: http://www.lcdf.org/gifsicle/man.html Specifies how to remove a frame before displaying the next. Use numerical values (0-7) or names like 'none', 'asis', 'background', or 'previous'. '--no-disposal' defaults to 'none'. ```bash gifsicle --disposal background a.gif ``` -------------------------------- ### Extension Options Source: http://www.lcdf.org/gifsicle/man.html Options for adding or removing non-visual metadata such as application extensions, comments, and frame names. ```APIDOC ## Extension Options ### Description Add or remove non-visual information to the output GIF, including application-specific data, comments, and frame names. ### Parameters - **--app-extension** (app-name, extension) - Add an application extension. - **--comment** (text) - Add a comment to the output GIF. - **--extension** (number, extension) - Add an extension by number. - **--name** (text) - Set the next frame's name. ``` -------------------------------- ### Gifsicle General Options Source: http://www.lcdf.org/gifsicle/man.html General options control the information Gifsicle prints and where it writes its output. Many options can be turned off with '--no-X'. ```APIDOC ## General Options ### Description General options control the information **gifsicle** prints and where it writes its output. The info options and **--verbose** can be turned off with ‘**--no-X**’. ### Options - **--info**, **-I** Print a human-readable description of each input GIF to the standard output, or whatever file you specify with **-o**. This option suppresses normal output, and cannot be combined with mode options like **--batch**. If you give two **--info** or **-I** options, however, information is printed to standard error, and normal output takes place as usual. - **--color-info**, **--cinfo** Like **--info**, but also print information about input files’ colormaps. - **--extension-info**, **--xinfo** Like **--info**, but also print any unrecognized GIF extensions in a **hexdump**(1)-like format. - **--size-info**, **--sinfo** Like **--info**, but also print information about compressed image sizes. - **--help**, **-h** Print usage information and exit. - **-o** _file_, **--output** _file_ Send output to _file_. The special filename ‘-’ means the standard output. - **--verbose**, **-V** Print progress information (files read and written) to standard error. - **--no-warnings**, **-w** Suppress all warning messages. - **--no-ignore-errors** Exit with status 1 when encountering a very erroneous GIF. Default is to muddle on. - **--version** Print the version number and some short non-warranty information and exit. - **--careful** Write slightly larger GIFs that avoid bugs in some other GIF implementations. Some Java and Internet Explorer versions cannot display the correct, minimal GIFs that Gifsicle produces. Use the **--careful** option if you are having problems with a particular image. - **--conserve-memory** Conserve memory usage at the expense of processing time. This may be useful if you are processing large GIFs on a computer without very much memory. Or say **--no-conserve-memory**. - **--nextfile** Allow input files to contain multiple concatenated GIF images. If a filename appears multiple times on the command line, **gifsicle** will read a new image from the file each time. This option can help scripts avoid the need for temporary files. For example, to create an animated GIF with three frames with different delays, you might run "**gifsicle --nextfile -d10 - -d20 - -d30 - > out.gif**" and write the three GIF images, in sequence, to **gifsicle**’s standard input. - **--multifile** Like **--nextfile**, but read _as many GIF images as possible_ from each file. This option is intended for scripts. For example, to merge an unknown number of GIF images into a single animation, run "**gifsicle --multifile - > out.gif**" and write the GIF images, in sequence, to **gifsicle**’s standard input. Any frame selections apply only to the last file in the concatenation. ``` -------------------------------- ### Apply Web-Safe Palette Subset Source: http://www.lcdf.org/gifsicle/man.html Modifies 'anim.gif' to use a 64-color subset of the Web-safe palette. The -b flag modifies the file in place. ```bash gifsicle -b --colors=64 --use-col=web anim.gif ``` -------------------------------- ### Interlace GIF Image Source: http://www.lcdf.org/gifsicle/man.html Use this command to create an interlaced version of a GIF image. The output is written to a new file. ```bash gifsicle -i < pic.gif > interlaced-pic.gif ``` -------------------------------- ### Color Transformation Options Source: http://www.lcdf.org/gifsicle/man.html Options for changing specific colors within the GIF or transforming the entire colormap. ```APIDOC ## Color Transformation Options ### Description Options to modify specific colors or transform the entire colormap of the GIF. ### Options - **--change-color** _color1_ _color2_ Change all occurrences of _color1_ to _color2_ in the input GIFs. This option can be specified multiple times to change multiple colors. Color changes are applied as the GIF is read and do not interfere with each other. - **--no-change-color** Cancel all previously specified color changes. - **--transform-colormap** _command_ Apply a shell command to transform each colormap. The command receives the colormap in text format via standard input and should output the transformed colormap in the same format to standard output. Pixel color indices are preserved, meaning pixels that used color slot _n_ in the input will still use color slot _n_ in the output after transformation. ``` -------------------------------- ### Animation Options Overview Source: http://www.lcdf.org/gifsicle/man.html Animation options apply to GIF animations or individual frames. Most options have --X, --no-X, and --same-X forms and can be applied multiple times. ```APIDOC ## Animation Options Overview Animation options apply to GIF animations, or to individual frames in GIF animations. As with image options, most animation options have three forms, '**--X** ', '**--no-X** ', and '**--same-X** ', and you can give animation options multiple times. ### Example ```bash gifsicle -b a.gif -d50 "#0" "#1" -d100 "#2" "#3" ``` This command sets the delays of frames 0 and 1 to 50, and frames 2 and 3 to 100. ``` -------------------------------- ### Set Animation Loop Count Source: http://www.lcdf.org/gifsicle/man.html Configures the Netscape loop extension. Use an integer for the number of loops or 'forever' for endless looping. '--no-loopcount' disables looping. ```bash gifsicle --loopcount 5 a.gif ``` ```bash gifsicle --loopcount forever a.gif ``` ```bash gifsicle --no-loopcount a.gif ``` -------------------------------- ### Explode Animation into Frames Source: http://www.lcdf.org/gifsicle/man.html Deconstructs an animation file 'anim.gif' into its individual frames, naming them sequentially (e.g., anim.gif.000, anim.gif.001). ```bash gifsicle --explode anim.gif ``` -------------------------------- ### Frame Change Options Source: http://www.lcdf.org/gifsicle/man.html Options for inserting new frames or replacing/deleting existing frames in a GIF animation. ```APIDOC ## Frame Change Options Frame change options insert new frames into an animation or replace or delete frames that already exist. ### --delete frames [frames...] **Description**: Delete frames from the input GIF. **Parameters**: - **frames** (frame selection) - Required - The frames to delete. ### --insert-before frame other-GIFs **Description**: Insert other-GIFs before the specified frame in the input GIF. **Parameters**: - **frame** (frame selection) - Required - The frame before which to insert. - **other-GIFs** (GIF input files and frame selections) - Required - The GIFs to insert. ### --append other-GIFs **Description**: Append other-GIFs to the input GIF. **Parameters**: - **other-GIFs** (GIF input files and frame selections) - Required - The GIFs to append. ### --replace frames other-GIFs **Description**: Replace frames from the input GIF with other-GIFs. **Parameters**: - **frames** (frame selection) - Required - The frames to replace. - **other-GIFs** (GIF input files and frame selections) - Required - The GIFs to use for replacement. ### --done **Description**: Complete the current set of frame changes. **Note**: The _frames_ arguments always refer to frames from the _original_ input GIF. The _other-GIFs_ arguments are combined in merge mode and added to the input GIF. ### Example 1: Delete and Replace ``` gifsicle a.gif --delete "#0" --replace "#2" b.gif ``` **Description**: This command deletes the first frame of `a.gif` and replaces the third frame of `a.gif` with frames from `b.gif`, producing an output animation with 2 frames. ### Example 2: Replace with Merged GIFs ``` gifsicle -b in.gif --replace "#0" a.gif b.gif ``` **Description**: This command replaces the first frame of `in.gif` with a merge of `a.gif` and `b.gif`. ### Example 3: Sequential Replacement ``` gifsicle -b in.gif --replace "#0" a.gif --done b.gif ``` **Description**: This command replaces the first frame of `in.gif` with `a.gif`, and then processes `b.gif` separately. **Warning**: Avoid using both frame selections and frame changes on the same input GIF. ``` -------------------------------- ### Combine GIFs into Animation Source: http://www.lcdf.org/gifsicle/man.html Combine multiple GIF files into a single animation. By default, gifsicle combines input files into a flipbook animation and writes to standard output. ```bash gifsicle pic1.gif pic2.gif pic3.gif > animation.gif ``` -------------------------------- ### Replace Frame in Optimized GIF Source: http://www.lcdf.org/gifsicle/man.html Replaces the second frame (index #1) of 'anim.gif' with the content of 'x.gif'. Requires '--unoptimize' because the input GIF was previously optimized. Output is re-optimized. ```bash gifsicle -b --unoptimize -O2 anim.gif --replace "#1" x.gif ``` -------------------------------- ### Image Transformation Options Source: http://www.lcdf.org/gifsicle/man.html These options apply to entire GIFs during read or write operations and can be disabled using '--no-option'. ```APIDOC ## Image Transformation Options Image transformation options apply to entire GIFs as they are read or written. They can be turned off with ‘**--no-option**’. ### --resize [width] x [height] **Description**: Resize the output GIF to the given width and height. If width or height is an underscore ‘_’, that dimension is chosen so that the aspect ratio remains unchanged. Resizing happens after all input frames have been combined and before optimization. Resizing uses logical screen dimensions; if the input stream has an unusual logical screen (many GIF displayers ignore logical screens), you may want to provide **--no-logical-screen** (or **+S**) to reset it so **gifsicle** uses image dimensions instead. See also **--resize-method**. ### --resize-width [width] **Description**: Resize to a given width, preserving aspect ratio. Equivalent to **--resize** [width] x. ### --resize-height [height] **Description**: Resize to a given height, preserving aspect ratio. Equivalent to **--resize** x [height]. ### --resize-fit [width] x [height] **Description**: Resize the output GIF to fit a rectangle with dimensions width x height. The aspect ratio remains unchanged. This option only shrinks the image—no resize is performed if the GIF already fits within the rectangle. ### --resize-touch [width] x [height] **Description**: Resize the output GIF to fit a rectangle with dimensions width x height. The aspect ratio remains unchanged. This option may shrink or grow the image; the output GIF will have width [width], height [height], or both. Either width or height may be an underscore ‘_’, which leaves that dimension unconstrained. ### --resize-fit-width [width] **Description**: Like **--resize-fit**, but constrains only the width. ### --resize-fit-height [height] **Description**: Like **--resize-fit**, but constrains only the height. ### --resize-touch-width [width] **Description**: Like **--resize-touch**, but constrains only the width. ### --resize-touch-height [height] **Description**: Like **--resize-touch**, but constrains only the height. ### --resize-geometry [geometry] **Description**: Resize to a geometry specification as used in ImageMagick and GraphicsMagick. _Geometry_ should match ‘_width_ x _height_[%][!][^][<][>]’, where _width_ and _height_ are integers (or underscores, ‘_’, which leaves that dimension unconstrained). The suffixes mean: - **%**: Treat the dimensions as percentages of the current size. - **!**: Resize to given dimensions ignoring original aspect ratio. - **<**: Resize only if the image is smaller than the specified size. - **>**: Resize only if the image is larger than the specified size. - **^**: Dimensions are treated as minimum rather than maximum values. ### --scale [Xfactor][x [Yfactor]] **Description**: Scale the output GIF’s width and height by Xfactor and Yfactor. If Yfactor is not given, it defaults to Xfactor. Scaling happens after all input frames have been combined and before optimization. ### --resize-method [method] **Description**: Set the method used to resize images. The ‘sample’ method runs very quickly, but when shrinking images, it produces noisy results. The ‘mix’ method is somewhat slower, but produces better-looking results. The default method is currently ‘mix’. Details: The resize methods differ most when shrinking images. The ‘sample’ method is a point sampler: each pixel position in the output image maps to exactly one pixel position in the input. When shrinking, full rows and columns from the input are dropped. The other methods use all input pixels, which generally produces better-looking images. The ‘box’ method, a box sampler, is faster than the more complex filters and produces somewhat sharper results, but there will be anomalies when shrinking images by a small amount in one dimension. (Some output pixels will correspond to exactly 1 input row or column, while others will correspond to exactly 2 input rows or columns.) The ‘mix’ method is a full bilinear interpolator. This is slower and produces somewhat blurrier results, but avoids anomalies. Gifsicle also supports more complex resamplers, including Catmull-Rom cubic resampling (‘catrom’), the Mitchell-Netravali filter (‘mitchell’), a 2-lobed Lanczos filter (‘lanczos2’), and a 3-lobed Lanczos filter (‘lanczos3’). These filters are slower still, but can give sharper, better results. ### --resize-colors [n] **Description**: Allow Gifsicle to add intermediate colors when resizing images. Normally, Gifsicle’s resize algorithms use input images’ color palettes without changes. When shrinking images with very few colors (e.g., pure black-and-white images), adding intermediate colors can improve the results. Example: **--resize-colors** 64 allows Gifsicle to add intermediate colors for images that have fewer than 64 input colors. ``` -------------------------------- ### Preserve Empty Transparent Frames Source: http://www.lcdf.org/gifsicle/man.html Ensures that empty transparent frames, which are normally dropped during optimization, are retained in the GIF animation. ```bash gifsicle --optimize=3 --keep-empty a.gif ``` -------------------------------- ### Overlay Two GIFs Source: http://www.lcdf.org/gifsicle/man.html Overlays 'top.gif' onto 'bottom.gif' to produce a single-frame result.gif. The first gifsicle command processes the input GIFs, and the second applies the '-U "#1"' option to the piped output, likely to remove the top layer after compositing. ```bash gifsicle bottom.gif top.gif | gifsicle -U "#1" > result.gif ``` -------------------------------- ### Image Modification Options Source: http://www.lcdf.org/gifsicle/man.html Options for modifying GIF frames including background, cropping, flipping, interlacing, logical screen, positioning, rotation, and transparency. ```APIDOC ## Image Options ### Description Modify input images by changing interlacing, transparency, cropping, and other visual properties. Options support --X (set), --no-X (off), and --same-X (copy from input). ### Parameters - **--background** (color) - Set output background color. - **--crop** (x1,y1,x2,y2 or x1,y1,width,height) - Crop frames to a rectangular area. - **--crop-transparency** (flag) - Crop transparent borders off frames. - **--flip-horizontal / --flip-vertical** (flag) - Flip frames. - **--interlace** (flag) - Turn interlacing on. - **--logical-screen** (width x height) - Set output logical screen dimensions. - **--position** (x,y) - Set frame positions. - **--rotate-90 / --rotate-180 / --rotate-270** (flag) - Rotate frames. - **--transparent** (color) - Make a specific color transparent. ``` -------------------------------- ### Define Text Colormap Format Source: http://www.lcdf.org/gifsicle/man.html Specifies the format for text files used to define custom colormaps. Each line represents a color using RGB values or web hex notation. ```text ; each non-comment line represents one color, "red green blue" ; each component should be between 0 and 255 0 0 0 ; like this 255 255 255 ; or use web hex notation #ffffff ; like this ``` -------------------------------- ### Set Animation Frame Delays Source: http://www.lcdf.org/gifsicle/man.html Sets the delay between frames for specified frames. Use multiple times to set different delays for different frame ranges. ```bash gifsicle -b a.gif -d50 "#0" "#1" -d100 "#2" "#3" ``` -------------------------------- ### Gifsicle Frame Selections Source: http://www.lcdf.org/gifsicle/man.html Frame selections tell gifsicle which frames to use from the current input file, useful for animations. ```APIDOC ## Frame Selections ### Description A frame selection tells **gifsicle** which frames to use from the current input file. They are useful only for animations, as non-animated GIFs only have one frame. Here are the acceptable forms for frame specifications. ### Forms - **#**_num_ Select frame _num_. (The first frame is ‘**#0**’. Negative numbers count backwards from the last frame, which is ‘**#-1**’.) - **#**_num1_**-**_num2_ Select frames _num1_ through _num2_. - **#**_num1_**-** Select frames _num1_ through the last frame. - **#**_name_ Select the frame named _name_. The ‘#’ character has special meaning for many shells, so you generally need to quote it. For example: ``` gifsicle happy.gif "#0" ``` uses the first frame from happy.gif; ``` gifsicle happy.gif "#0-2" ``` uses its first three frames; and ``` gifsicle happy.gif "#-1-0" ``` uses its frames in reverse order (starting from frame #-1—the last frame—and ending at frame #0—the first). The action performed with the selected frames depends on the current mode. In merge mode, only the selected frames are merged into the output GIF. In batch mode, only the selected frames are modified; other frames remain unchanged. In explode mode, only the selected frames are exploded into output GIFs. ``` -------------------------------- ### Batch Interlace GIFs Source: http://www.lcdf.org/gifsicle/man.html Modify all GIF files in the current directory in place to be interlaced. Use the --batch option to modify files directly instead of writing to standard output. ```bash gifsicle --batch -i *.gif ``` -------------------------------- ### Disposal Method Source: http://www.lcdf.org/gifsicle/man.html Sets the disposal method for subsequent frames, determining how they are removed or managed. ```APIDOC ## Disposal Method ### Description Set the disposal method for the following frames to _method_. A frame's disposal method determines how a viewer should remove the frame when it's time to display the next. _Method_ can be a number between 0 and 7 (although only 0 through 3 are generally meaningful), or one of these names: **none** (leave the frame visible for future frames to build upon), **asis** (same as "none"), **background** (or **bg**) (replace the frame with the background), or **previous** (replace the frame with the area from the previous displayed frame). **--no-disposal** means **--disposal** =**none**. ### Method **-D** _method_ **--disposal** _method_ ``` -------------------------------- ### Edit GIF Animation by Replacing a Frame Source: http://www.lcdf.org/gifsicle/index.html Replace a specific frame in a GIF animation with a new GIF file. The '-b' flag indicates batch mode, modifying the file in place. ```bash gifsicle -b anim.gif --replace '#0' new.gif ``` -------------------------------- ### Frame Delay Source: http://www.lcdf.org/gifsicle/man.html Sets the delay between frames in a GIF animation. ```APIDOC ## Frame Delay ### Description Set the delay between frames to _time_ in hundredths of a second. ### Method **-d** _time_ **--delay** _time_ ``` -------------------------------- ### Extract Frame from GIF Animation Source: http://www.lcdf.org/gifsicle/index.html Extract a specific frame from a GIF animation. The frame is specified by its index (e.g., '#0' for the first frame). ```bash gifsicle anim.gif '#0' > firstframe.gif ``` -------------------------------- ### Delete Frames with Gifsicle Source: http://www.lcdf.org/gifsicle/man.html Use the --delete option to remove specific frames from a GIF. Frames are referenced by their original index. ```bash gifsicle a.gif --delete "#0" --replace "#2" b.gif ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.