Linux command
gifsicle 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Optimize a GIF
gifsicle --optimize=3 [input.gif] -o [output.gif]
Resize a GIF
gifsicle --resize [320x240] [input.gif] -o [output.gif]
Extract frames
gifsicle [input.gif] '#0-9' -o [frames.gif]
Create a GIF
gifsicle --delay=[10] [frame1.gif] [frame2.gif] -o [output.gif]
Change animation speed
gifsicle --delay=[5] [input.gif] -o [faster.gif]
Loop animation
gifsicle --loopcount=[3] [input.gif] -o [output.gif]
Make infinite loop
gifsicle --loopcount=forever [input.gif] -o [output.gif]
Reduce colors
gifsicle --colors [64] [input.gif] -o [output.gif]
说明
gifsicle is a command-line tool for creating, editing, and optimizing GIF images and animations. It can manipulate existing GIFs, combine multiple images into animations, extract frames, and significantly reduce file sizes. The optimization feature is particularly valuable: level 3 optimization can reduce GIF file sizes by 30-50% without quality loss by storing only changed pixels between frames. Frame selection uses '#' notation (e.g., '#0' for the first frame, '#0-5' for a range).
参数
- -o, --output _file_
- Write output to file.
- --optimize, -O _level_
- Optimize GIF (1=store only changed, 2=shrink, 3=max).
- --resize _WxH_
- Resize to specified dimensions.
- --resize-width _W_
- Resize to width, maintaining aspect ratio.
- --resize-height _H_
- Resize to height, maintaining aspect ratio.
- --scale _factor_
- Scale by factor (e.g., 0.5 for half size).
- --delay _time_
- Set frame delay in hundredths of a second.
- --loopcount _n_
- Set loop count (0 or forever for infinite).
- --colors _n_
- Reduce to n colors (2-256).
- --color-method _method_
- Color reduction method: diversity, blend-diversity, median-cut.
- --crop _x,y+WxH_
- Crop to specified region.
- --rotate-90, --rotate-180, --rotate-270
- Rotate image.
- --flip-horizontal, --flip-vertical
- Flip image.
- --unoptimize, -U
- Unoptimize (expand each frame to full image).
- --explode
- Write each frame to separate file.
- --info, -I
- Show information about the GIF.
- --batch, -b
- Modify files in place.
FAQ
What is the gifsicle command used for?
gifsicle is a command-line tool for creating, editing, and optimizing GIF images and animations. It can manipulate existing GIFs, combine multiple images into animations, extract frames, and significantly reduce file sizes. The optimization feature is particularly valuable: level 3 optimization can reduce GIF file sizes by 30-50% without quality loss by storing only changed pixels between frames. Frame selection uses '#' notation (e.g., '#0' for the first frame, '#0-5' for a range).
How do I run a basic gifsicle example?
Run `gifsicle --optimize=3 [input.gif] -o [output.gif]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o, --output _file_ do in gifsicle?
Write output to file.