[Gifsicle],壓縮、優(yōu)化gif的命令行工具 —— 中英文對照文檔

聲明:業(yè)余時間閑著無聊,正好用到了這個gifsicle,覺得挺好用的一個工具,所以就把官方的使用文檔給簡單翻譯了一下,不對正確之處,勿噴,還望指正;如果覺得不妥,還是官方文檔為準(zhǔn)。雖然gifsicle使用并不是很難,但是命令還挺多的,然而簡書的mrkdown語法不支持頁面跳轉(zhuǎn),我這里用注腳的方式寫了個目錄,但是目錄在文檔末尾,比較麻煩;最好的方式是使用Ctrl+F在整個頁面搜索所需命令及其釋義和示例。文檔中 【??:xxxxxx 】為翻譯內(nèi)容。


NAME[1]

gifsicle ? manipulates GIF images and animations 【??:操作GIF圖片和動畫】

SYNOPSIS(概要)[2]

gifsicle [options, frames, and filenames]...

DESCRIPTION(描述)[3]

gifsicle is a powerful command-line program for creating, editing, manipulating, and getting information about GIF images and animations.【??:gifsicle是一個款強(qiáng)大的用于創(chuàng)建、編輯、操作GIF圖片和動畫以及獲取GIF的信息的命令行程序.】

Gifsicle normally processes input GIF files according to its command line options and writes the result to the standard output. The ?i option, for example, tells gifsicle to interlace its inputs:【??:Gifsicle一般情況下, 根據(jù)命令行的可選命令來處理輸入的GIF文件. 如命令 ?i, 它會告知 gifsicle 去結(jié)合它的輸入文件:】

gifsicle ?i < pic.gif > interlaced-pic.gif

Gifsicle is good at creating and manipulating GIF animations. By default, it combines two or more input files into a “flipbook” animation:【??:Gifsicle 善于創(chuàng)建和操作GIF動畫。默認(rèn)情況,它會合并(串聯(lián))2個或者更多文件到一個可以輪播的動畫中:】

gifsicle pic1.gif pic2.gif pic3.gif > animation.gif

Use options like ??delay, ??loopcount, and ??optimize to tune your animations.【??:使用可選命令,像 ??delay, ??loopcount, 和 ??optimize 來調(diào)整你的GIF動畫.】

To modify GIF files in place, use the ??batch option. With ??batch, gifsicle will modify the files you specify instead of writing a new file to the standard output. To interlace(使結(jié)合、使交錯)all the GIFs in the current directory, you could say:【??:適當(dāng)修改GIF文件, 使用可選命令 ??batch. ,使用 ??batch, gifsicle 將修改您指定的文件,而不是將新文件寫入到標(biāo)準(zhǔn)輸出. 為了結(jié)合當(dāng)前目錄下的所有GIF動畫, 你可以使用如下命令:】

gifsicle ??batch ?i *.gif

New users may want to skip to the Examples section at the end.【??:新用戶可能希望直接跳到最后的Examples(示例)部分.】

CONCEPT INDEX(概念索引)[4]

Concepts are on the left, relevant gifsicle options are on the right.【??:左側(cè)是概念, 相應(yīng)的 gifsicle 命令在右側(cè).】

此部分略


COMMAND LINE(命令行)[5]

gifsicle’s command line consists of GIF input files and options. Most options start with a dash (?) or plus (+); frame ,selections, a kind of option, start with a number sign (#). Anything else is a GIF input file.【??:gifsicle’s 命令行包含GIF輸入文件和命令可選項. 大部分命令可選項是以(?)和(+)開頭; 幀的選擇(frame selections), 是一種可選命令, 它是以(#)開頭.其他任何東西都是GIF輸入文件.】

gifsicle reads and processes GIF input files in order. If no GIF input file is given, or you give the special filename ‘?’, it reads from the standard input.【??:gifsicle 按順序讀取和處理GIF輸入文件.如果沒有給出GIF輸入文件,或者您給出特殊文件名 ‘?’, 它從標(biāo)準(zhǔn)輸入讀取.】

gifsicle exits with status 0 if there were no errors and status 1 otherwise.【??:gifsicle 會退出如果沒有錯誤,狀態(tài)為0,否則狀態(tài)為1.】

OPTIONS(可選命令行)[6]

Every option has a long form, ‘??long?descriptive?name’. You don’t need to type the whole long descriptive name, just enough to make it unambiguous.【??:每個可選項命令行都有很長的形式,‘ ??long?descriptive?name ’. 您不需要鍵入整個長描述性名稱,使其明確無誤就足夠了.】

Some options also have a short form, ‘?X’. You can combine short options if they don’t take arguments: ‘?IIb’ is the same as ‘?I ?I ?b’. But be careful with options that do take arguments: ‘?cblah’ means ‘?c blah’, not ‘?c ?b ?l ?a ?h’.【??:有些可選項命令行也有簡短形式, ‘?X’.如果不帶參數(shù),您可以組合這些短選項,例如:‘?IIb’和‘?I ?I ?b’是一樣的.但要注意那些帶參數(shù)的選項,例如:‘?cblah’ 的意思是‘?c blah’, 而不是 ‘?c ?b ?l ?a ?h’的組合.】

Many options also have a converse, ‘??no?option’, which turns off the option. You can turn off a short option ‘?X’ by saying ‘+X’ instead.【??:很多可選命令也有自身相反的命令, ‘??no?option’,這個命令的意思是可以關(guān)閉可選項. 您可以通過說‘+X’ 來關(guān)閉短選項‘?X’.】

Mode Options

Mode options tell gifsicle what kind of output to generate. There can be at most one, and it must precede any GIF inputs.【??:模式命令選項告訴 gifsicle 要生成什么樣的輸出。最多可以有一個,它必須在任何GIF輸入之前.】

??merge, ?m
Combine all GIF inputs into one file with multiple frames and write that file to the standard output. This is the default mode.【??:將所有GIF輸入合并為一個具有多個幀的文件,并將該文件寫入標(biāo)準(zhǔn)輸出。 這是默認(rèn)模式.】

??batch, ?b
Modify each GIF input in place by reading and writing to the same filename. (GIFs read from the standard input are written to the standard output.)【??:通過讀取和寫入相同的文件名來修改每個GIF輸入。(從標(biāo)準(zhǔn)輸入讀取的GIF將寫入標(biāo)準(zhǔn)輸出.)】

??explode, ?e
Create an output GIF for each frame of each input file. The output GIFs are named ‘xxx.000’, ‘xxx.001’, and so on, where ‘xxx’ is the name of the input file (or whatever you specified with ‘??output’) and the numeric extension is the frame number.【??:為每個輸入文件的每個幀創(chuàng)建一個輸出GIF。 輸出GIF名為'xxx.000','xxx.001',依此類推,其中'xxx'是輸入文件的名稱(或者您使用‘ ??output ’指定的任何名稱)數(shù)字?jǐn)U展名為 幀號.】

??explode?by?name, ?E
Same as ??explode, but write any named frames to files ‘xxx.name’ instead of ‘xxx.frame-number’. Frames are named using the ‘??name’ option.【??:與??explode相同,但將任何命名幀寫入文件'xxx.name'而不是'xxx.frame-number'。 框架使用??name選項命名.】

General Options

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’. ??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.【??:將進(jìn)度信息(讀取和寫入的文件)打印到標(biāo)準(zhǔn)錯誤.】

??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.【??:遇到非常錯誤的GIF時退出狀態(tài)1. 默認(rèn)是混亂.】

??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.

Frame Selections

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.

參數(shù) 含義
#num Select frame num. (The first frame is‘#0’. Negative numbers count backwardsfrom 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.

Frame Change Options

Frame change options insert new frames into an animation or replace or delete frames that already exist. Some things ?? for example, changing one frame in an animation ?? are difficult to express with frame selections, but easy with frame changes. 【??:幀改變選項命令(Frame change options)會向一個動畫中插入一個新的幀或者代替、刪除一些幀從已存在的動畫中。有些事??例如,在幀選擇選項命令(frame selections)改變一幀是困難的,但是幀改變選項命令(Frame change options)就很容易.】

??delete frames [frames...]
Delete frames from theinput GIF 【??:(刪除幀;可以連續(xù)選擇多個幀刪除).】

示例:gifsicle b.gif --delete "#0" -o test.gif

??insert?before frame other-GIFs
Insert other-GIFs before frame in the input GIF【??:(在指定frame前插入其他GIF動畫(other-GIFs)).】

示例:gifsicle a.gif ??insert?before "#2" b.gif -o test.gif

??append other-GIFs
Append other-GIFs to the input GIF【??:(在一個GIF動畫后面加入其他GIF動畫(other-GIFs)).】

示例:gifsicle a.gif --append b.gif -o test.gif

??replace frames other-GIFs
Replace frames from the input GIF with other-GIFs【??:(將指定幀(frames)替換成其他GIF動畫(other-GIFs)).】

示例:gifsicle a.gif --replace "#2" b.gif -o test.gif

??done
Complete the current set of frame changes 【??:(完成了對當(dāng)前幀集的更改).】

The frames arguments are frame selections (see above). These arguments always refer to frames from the original input GIF. So, if ‘a(chǎn).gif’ has 3 frames and ‘b.gif’ has one, this command【??:參數(shù) frames 是幀選擇命令可選項(frame selections)表示的 (請看之前frame selections的相關(guān)命令).這些參數(shù)總是涉及到原始輸入GIF動畫的幀. 因此,以下命令的意思是,刪除‘a(chǎn).gif’的第一幀,然后將‘a(chǎn).gif’的第三幀用‘b.gif’替換了】

gifsicle a.gif ??delete "#0" ??replace "#2" b.gif

will produce an output animation with 2 frames: ‘a(chǎn).gif’ frame 1, then ‘b.gif’.【??:這命令將產(chǎn)生一個刪除了‘a(chǎn).gif’的第一幀,然后將‘a(chǎn).gif’的第三幀用‘b.gif’替換了的動畫. 注意:這2個命令不能一起使用,否則會提示警告: gifsicle: fatal error: frame selection and frame changes don't mix

The other-GIFs arguments are any number of GIF input files and frame selections. These images are combined in merge mode and added to the input GIF. The other-GIFs last until the next frame change option, so this command replaces the first frame of ‘in.gif’ with the merge of ‘a(chǎn).gif’ and ‘b.gif’:【??:參數(shù):other-GIFs,可以任意數(shù)量的GIF文件或者幀(通過frame selections獲取的)。在合并模式這些圖像組合并添加到輸入GIF。other-GIFs 會持續(xù)到下一個幀更改選項(frame change option),所以這個命令的意思是:將‘a(chǎn).gif’ and ‘b.gif’合并后替換掉‘in.gif’的第一幀】

gifsicle ?b in.gif ??replace "#0" a.gif b.gif

This command, however, replaces the first frame of ‘in.gif’ with ‘a(chǎn).gif’ and then processes‘b.gif’ separately:【??:但是,這個命令用'a.gif'替換'in.gif'的第一幀,然后分別處理'b.gif':】

gifsicle ?b in.gif ??replace "#0" a.gif ??done b.gif

Warning: You shouldn’t use both frame selections and frame changes on the same input GIF.【??:Warning: 不能對同一個輸入的GIF動畫,同時使用frame selections and frame changes命令. 其實(shí)沒太明白這句話的意思,按照我的理解應(yīng)該是不同同時使用2個都具有frame selections and frame changes的命令,而不是不能同時使用frame selections and frame changes命令】

Image Options

Image options modify input images ?? by changing their interlacing, transparency, and cropping, for example. Image options have three forms: ‘??X’, ‘??no?X’, and ‘??same?X’. The ‘??X’ form selects a value for the feature, the ‘??no?X’ form turns off the feature, and the ‘??same?X’ form means that the feature’s value is copied from each input. The default is always ‘??same?X’. For example, ?background="#0000FF" sets the background color to blue, ??no?background turns the background color off (by setting it to 0), and ??same?background uses input images’ existing background colors. You can give each option multiple times; for example,【??:圖像命令可選項(Image options)可修改輸入圖像, 通過改變他們的interlacing, transparency, and cropping. 例如,Image options有三種形式:‘??X’, ‘??no?X’, 和 &lsquo ??same?X’. ‘??X’ 形式是為某個特性選擇一個值, ‘??no?X’ 的形式是關(guān)閉這個特性, 而‘??same?X’ 形式是從輸入的文件中復(fù)制特性的值. 默認(rèn)情況總是‘??same?X’ 例如:?background="#0000FF"意思是設(shè)置背景色為藍(lán)色;??no?background意思是關(guān)閉了背景色選項(通過設(shè)置它為0); ??same?background 的意思是使用和輸入圖像一樣的背景色.您可以多次提供每個選項;例如,】

gifsicle ?b ?O2 ?i a.gif ??same?interlace b.gif c.gif

will make ‘a(chǎn).gif’ interlaced, but leave ‘b.gif’ and ‘c.gif’ interlaced only if they were already.【??:這個interlaced一直不知道啥意思,哎,暫時沒有理解???】

?B color
??background color

Set the output GIF’s background to color. The argument can have the same forms as in the ??transparent option below【??:(設(shè)置背景色,這個和??transparent 有著相同的用法).】

示例:gifsicle -B 255 -i 1.gif "#0" -o test.gif

??crop x1,y1-x2,y2
??crop x1,y1+widthxheight

Crop the following input frames to a smaller rectangular area. The top-left corner of this rectangle is (x1,y1); you can give either the lower-right corner, (x2,y2), or the width and height of the rectangle. In the x1,y1+widthxheight form,width and height can be zero or negative. A zero dimension means the cropping area goes to the edge of the image; a negative dimension brings the cropping area that many pixels back from the image edge. For example, ??crop 2,2+-2x-2 will shave 2 pixels off each side of the input image. Cropping takes place before any rotation, flipping, resizing, or positioning.【??:將輸入幀剪為較小的矩形區(qū)域.參數(shù)(x1,y1)為矩形區(qū)域的左上角,(x2,y2)為矩形的右下角;(widthxheight)表示矩形的寬和高,寬和高可以是0和負(fù)數(shù); 裁剪在任何旋轉(zhuǎn),翻轉(zhuǎn),調(diào)整大小或定位之前進(jìn)行.】

示例:gifsicle --crop 10,10-50,50 -i 2.gif "#0" -o test.gif
示例:gifsicle --crop 200,200+100x100 -i 2.gif "#0" -o test.gif

??crop?transparency

Crop any transparent borders off the following input frames. This happens after any cropping due to the ??crop option. It works on the raw input images; for example, any transparency options have not yet been applied.【??:(暫時未發(fā)現(xiàn)其實(shí)用之處)】

示例:gifsicle --crop 200,200+-100x100 --crop-transparency -i 1.gif "#0" -o test.gif

??flip?horizontal
??flip?vertical

Flip the following frames horizontally or vertically【??:(水平和垂直翻轉(zhuǎn)).】

示例:gifsicle --crop 200,200+-100x100 --flip-horizontal -i 1.gif "#0" -o test.gif

?i
??interlace

Turn interlacing on.

?S widthxheight
??logical?screen widthxheight

Set the output logical screen to widthxheight. ??no?logical?screen sets the output logical screen to the size of the largest output frame, while ??same?logical?screen sets the output logical screen to the largest input logical screen. ??screen is a synonym for ??logical?screen.【??:widthxheight設(shè)置輸出文件的邏輯屏幕的寬高.??no?logical?screen 設(shè)置輸出文件的邏輯屏幕寬高為最大, ??same?logical?screen設(shè)置輸出文件的邏輯屏幕寬高為輸入文件的寬高. ??screen??logical?screen有相同的語義.】

示例:gifsicle --crop 200,200+-100x100 --flip-horizontal -i 1.gif "#0" -o test.gif

?p x,y
??position x,y

Set the following frames’ positions to (x,y). ??no?position means ??position 0,0. Normally, ??position x,y places every succeeding frame exactly at x,y. However, if an entire animation is input, x,y is treated as the position for the animation.

示例:gifsicle -p 100,100 -i 1.gif -o test.gif
示例:gifsicle -p 100,100 -i 1.gif "#0" -i 2.gif -o test.gif

??rotate?90
??rotate?180
??rotate?270

Rotate the following frames by 90, 180, or 270 degrees. ??no?rotate turns off any rotation【??:(逆時針旋轉(zhuǎn)).】

示例:gifsicle --rotate-90 -i 2.gif -o test.gif

?t color
??transparent color

Make color transparent in the following frames. Color can be a colormap index (0?255), a hexadecimal color specification (like "#FF00FF" for magenta), or slash- or comma-separated red, green and blue values (each between 0 and 255).【??:使GIF動畫的 color 透明. Color 的值可以是(0?255), 也可以是一個指定的16進(jìn)制 (像 "#FF00FF"), 或者使用'/' 或者','隔開RGB對應(yīng)的數(shù)值(RGB的值分別可以從0到255之間).】

示例:gifsicle --transparent 120 -i < 1.gif > test.gif


Extension Options(這項實(shí)用性不是很大)

Extension options add non-visual information to the output GIF. This includes names, comments, and generic extensions.【??:擴(kuò)展選項將非可視信息添加到輸出GIF。 這包括名稱,注釋和通用擴(kuò)展.】

??app?extension app?name extension

Add an application extension named app?name and with the value extension to the output GIF.??no?app?extensions removes application extensions from the input images.

?c text
??comment text

Add a comment, text, to the output GIF. The comment will be placed before the next frame in the stream. ??no?comments removes comments from the input images.

??extension number extension

Add an extension numbered number and with the value extension to the output GIF. Number can be in decimal, octal, hex, or it can be a single character like ‘n’, whose ASCII value is used. ??no?extensions (or +x) removes extensions from the input images.

?n text
??name text

Set the next frame’s name to text. This name is stored as an extension in the output GIF (extension number 0xCE, followed by the characters of the frame name). ??no?names removes name extensions from the input images.

【】Animation Options

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; for example,【??:Animation options作用于GIF動畫或者GIF動畫的幀。和image options一樣,大部分的Animation options命令也有這三種形式:‘??X’,‘??no?X’, and ‘??same?X’ 你也可以多次使用這些命令,例如,】

gifsicle ?b a.gif ?d50 "#0" "#1" ?d100 "#2" "#3"

sets the delays of frames 0 and 1 to 50, and frames 2 and 3 to 100【??:(設(shè)置第一幀延遲為50,第二、三幀延遲為100).】

?d time
??delay time

Set the delay between frames to time in hundredths of a second.【??:以百分之一秒為單位設(shè)置幀之間的延遲.】

?D method
??disposal method (這個命令對于壓縮GIF幫助不大)

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.【??:參數(shù)method是對于幀的處理方法(disposal method), 一個幀的處理方法決定了觀看者在顯示下一幀時應(yīng)如何移除幀.method可以是0到7之間的數(shù)字(盡管通常只有0到3有意義)或者其中一個名稱:none(讓幀可見為了將來幀的構(gòu)建),asis (和"none"一樣),background(or bg) (用背景替換幀),或者 previous (用先前顯示的幀中的區(qū)域替換幀)??no?disposal 意思是 ??disposal=none. 】

?l [count]
??loopcount [=count]

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.【??:循環(huán)GIF動畫的次數(shù),0forever是一直循環(huán)下去;??no?loopcount表示關(guān)閉循環(huán)特性.】

示例:gifsicle -i 2.gif --loopcount=1 -o test.gif

?O [level]
??optimize [=level]

Optimize output GIF animations for space. Level determines how much optimization is done; higher levels take longer, but may have better results. There are currently three levels:【??:優(yōu)化輸出GIF動畫。級別確定完成了多少優(yōu)化; 更高的等級需要更長時間,但可能會有更好的結(jié)果, 目前有三個級別:】

參數(shù) 含義
?O1 Stores only the changed portion of each image. This is the default(僅存儲每個圖像(幀)的更改部分,這是默認(rèn)值).
?O2 Also uses transparency to shrink the file further(還使用透明度進(jìn)一步縮小文件).
?O3 Try several optimization methods (usually slower, sometimes better results)(嘗試多種優(yōu)化方法(通常較慢,有時更好的結(jié)果)).

Other optimization flags provide finer-grained control【??:(其他優(yōu)化標(biāo)志提供更精細(xì)的控制).】
?Okeep-empty
Preserve empty transparent frames (they are dropped by default)【??:(保留空透明幀(默認(rèn)情況下會丟棄)).】

You may also be interested in other options for shrinking GIFs, such as ?k and ??no?extensions.【??:您可能還對縮小GIF的其他選項感興趣,例如?k??no?extensions.】

示例:gifsicle -O2 -i 2.gif -o test.gif

?U
??unoptimize
Unoptimize GIF animations into an easy-to-edit form【??:(將GIF動畫優(yōu)化為易于編輯的形式).】

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.【??:GIF動畫經(jīng)常被優(yōu)化(參見??optimize)以使它們更小且加載更快,遺憾的是它們很難編輯。??unoptimize將優(yōu)化的輸入GIF更改為未優(yōu)化的GIF,其中每個幀都忠實(shí)地表示用戶在動畫中的該點(diǎn)所看到的內(nèi)容.】


Image Transformation Options(圖像轉(zhuǎn)換命令可選項)

Image transformation options apply to entire GIFs as they are read or written. They can be turned off with ‘??no?option’.【??:圖像轉(zhuǎn)換命令可選項適用于讀取或?qū)懭氲恼麄€GIF. 這些命令可以通過這個命令來關(guān)閉命令可選項 ‘??no?option’. 】

??resize widthxheight

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.

【??:將輸出GIF的大小調(diào)整為給定的寬度和高度。如果寬度或高度是下劃線'_',則選擇該尺寸以使寬高比保持不變. 在所有輸入幀組合之后和優(yōu)化之前調(diào)整大小。 調(diào)整大小使用邏輯屏幕尺寸;如果輸入流有一個不尋常的邏輯屏幕(許多GIF顯示器忽略邏輯屏幕),你可能想通過這個命令來重置邏輯屏幕的尺寸 ??no?logical?screen (or +S),因此 gifsicle 會使用圖片維度代替它. See also ??resize?method.】

??resize?width width
??resize?height height

Resize to a given width or height, preserving aspect ratio. Equivalent to ??resize widthx_ or ??resize xheight.【??:使用給定的寬度或高度來調(diào)整GIF文件, 保持寬高比不變. 相當(dāng)于??resize widthx 或者??resize _xheight.】

??resize?fit widthxheight
??resize?touch widthxheight

Resize the output GIF to fit within a rectangle with dimensions width x height. The aspect ratio remains unchanged. The ??resize?fit option only shrinks the image—no resize is performed if the GIF already fits within the rectangle. Either width or height may be an underscore ‘_’, which leaves that dimension unconstrained.

【??:調(diào)整輸出GIF的大小以適合尺寸為width x height的矩形. 寬高比保持不變. 命令??resize?fit 只僅僅縮小圖像—如果GIF已經(jīng)適合矩形,則不執(zhí)行調(diào)整大小. 寬度或高度可以是下劃線'_',這使得該維度不受約束.】

??resize?fit?width width
??resize?fit?height height
??resize?touch?width width
??resize?touch?height height

Like ??resize?fit and ??resize?touch, but constrains only one dimension.【??:像 ??resize?fit??resize?touch, 只僅僅約束一個維度.】

??scale Xfactor[xYfactor]

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.【??:通過XfactorYfactor來縮放GIF的寬和高(Xfactor和Yfactor以倍數(shù)的形式來縮放的). 如果沒有給定 Yfactor, 它默認(rèn)為Xfactor. 縮放操作一定要發(fā)生在所有幀數(shù)合并之后和優(yōu)化之前.】

??resize?method method

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’.【??:設(shè)置用于調(diào)整圖像大小的方法?!皹颖尽狈椒ㄟ\(yùn)行得非??欤钱?dāng)縮小圖像時,會產(chǎn)生嘈雜的結(jié)果。 'mix'方法有點(diǎn)慢,但產(chǎn)生更好看的結(jié)果。默認(rèn)方法目前是“混合”.】

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.【??:詳細(xì)信息:縮小圖像時,調(diào)整大小方法的差異最大。 “sample”方法是一個點(diǎn)采樣器:輸出圖像中的每個像素位置都映射到輸入中的一個像素位置。縮小時,輸入中的完整行和列將被刪除。其他方法使用所有輸入像素,這通常會產(chǎn)生更好看的圖像。盒子采樣器的“盒子”方法比更復(fù)雜的濾波器更快,并且產(chǎn)生更清晰的結(jié)果,但是當(dāng)在一個維度上縮小圖像少量時會出現(xiàn)異常。(某些輸出像素將精確對應(yīng)于1個輸入行或列,而其他輸出像素將恰好對應(yīng)于2個輸入行或列。)“混合”方法是完整的雙線性插值器。這樣較慢并且產(chǎn)生一些模糊的結(jié)果,但避免了異常.】

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.【??:Gifsicle還支持更復(fù)雜的重采樣器,包括Catmull-Rom立方重采樣('catrom'),Mitchell-Netravali濾波器('mitchell'),2瓣Lanczos濾波器('lanczos2')和3瓣Lanczos濾波器( 'lanczos3')。這些濾鏡仍然較慢,但可以提供更清晰,更好的效果.】

??resize?colors n

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.【??:允許Gifsicle在調(diào)整圖像大小時添加中間色。 通常,Gifsicle的調(diào)整大小算法使用輸入圖像的調(diào)色板而不做任何更改。 當(dāng)用非常少的顏色縮小圖像(例如,純黑白圖像)時,添加中間色可以改善結(jié)果。示例:??resize?colors允許Gifsicle為少于64種輸入顏色的圖像添加中間色.】

【】Color Options(顏色命令可選項)

Color options apply to entire GIFs as they are read or written. They can be turned off with ‘??no?option’.【??:(Color options適用于讀取或?qū)懭氲恼麄€GIF。 可以使用‘??no?option’關(guān)閉它們)】

?k num ??colors num

Reduce the number of distinct colors in each output GIF to num or less. Num must be between 2 and 256. This can be used to shrink output GIFs or eliminate any local color tables.【??:將每個輸出GIF中不同顏色的數(shù)量減少到num或更少.Num必須介于2到256之間.這可用于縮小輸出GIF或消除任何本地顏色表.

Normally, an adaptive group of colors is chosen from the existing color table. You can affect this process with the ??color?method option or by giving your own colormap with ??use?colormap. Gifsicle may need to add an additional color (making num+1 in all) if there is transparency in the image.【??:通常,從現(xiàn)有顏色表中選擇自適應(yīng)顏色組。 您可以使用??color?method選項或使用??use?colormap提供自己的色彩映射來影響此過程。 如果圖像中有透明度,Gifsicle可能需要添加其他顏色(讓參數(shù)num + 1).】

示例:gifsicle -k 60 -i 2.gif -o test.gif

??color?method method

Determine how a smaller colormap is chosen. ‘diversity’, the default, is xv(1)’s diversity algorithm, which uses a strict subset of the existing colors and generally produces good results. ‘blend?diversity’ is a modification of this: some color values are blended from groups of existing colors. ‘median?cut’ is the median cut algorithm described by Heckbert. ??method is a synonym for ??color?method.【??:確定如何選擇較小的色彩映射表.‘diversity’,默認(rèn)是xv(1)的多樣性算法,它使用現(xiàn)有顏色的嚴(yán)格子集,通常會產(chǎn)生良好的結(jié)果. ‘blend?diversity’是對此的修改:某些顏色值是從現(xiàn)有顏色組中混合而成.&lsquo median?cut’ 是Heckbert描述的中值切割算法. ??method??color?method具有相同語義】

示例:gifsicle --color-method blend-diversity -k 60 -i 2.gif -o test.gif
示例:gifsicle --color-method median-cut -k 60 -i 2.gif -o test1.gif
示例:gifsicle --color-method diversity -k 60 -i 2.gif -o test2.gif

?f
??dither [=method]

When ??dither is on and the colormap is changed, combinations of colors are used to approximate missing colors. This looks better, but makes bigger files and can cause animation artifacts, so it is off by default.【??:當(dāng)??dither打開并且顏色圖更改時,顏色組合用于近似缺失顏色。 這樣看起來更好,但是會生成更大的文件并導(dǎo)致動畫瑕疵,因此默認(rèn)情況下它是關(guān)閉的.】

Specify a dithering algorithm with the optional method argument. The default, ‘floyd-steinberg’, uses Floyd-Steinberg error diffusion. This usually looks best, but can cause animation artifacts, because dithering choices will vary from frame to frame. Gifsicle also supports ordered dithering algorithms that avoid animation artifacts. The ‘ro64’ mode uses a large,random-looking pattern and generally produces good results. The ‘o3’, ‘o4’, and ‘o8’ modes use smaller, more regular patterns. The ‘ordered’ mode chooses a good ordered dithering algorithm. For special effects, try the halftone modes ‘halftone’, ‘squarehalftone’, and ‘diagonal’. Some modes take optional parameters using commas. The halftone modes take a cell size and a color limit: ‘halftone,10,3’ creates 10-pixel wide halftone cells where each cell uses up to 3 colors.【??:使用可選的參數(shù)method指定抖動算法. 默認(rèn)的‘floyd-steinberg’,使用Floyd-Steinberg誤差擴(kuò)散。 這通??雌饋碜詈?,但可能會導(dǎo)致動畫瑕疵,因為抖動選擇會因幀而異。 Gifsicle還支持有序的抖動算法,可避免動畫偽影。 ‘ro64’ 模式使用大型隨機(jī)圖案,通常會產(chǎn)生良好的效果. ‘o3’, ‘o4’, 和 ‘o8’模式使用更小,更規(guī)則的模式. ‘ordered’模式選擇了良好的有序抖動算法. 對于特殊效果,嘗試半色調(diào)模式&lsquo halftone’,‘squarehalftone’, and‘diagonal’.某些模式使用逗號選擇可選參數(shù). 半色調(diào)模式采用單元格大小和顏色限制:‘halftone,10,3’創(chuàng)建10像素寬的半色調(diào)單元格,每個單元格最多使用3種顏色.】

示例:gifsicle --dither=halftone,10,3 -k 60 -i 2.gif -o test.gif
示例:gifsicle --dither=o3 -k 60 -i 2.gif -o test2.gif
示例:gifsicle --dither=squarehalftone -k 60 -i 2.gif -o test3.gif

??gamma gamma

Set the gamma correction to gamma, which can be a real number or ‘srgb’. Roughly speaking, higher numbers exaggerate shadows and lower numbers exaggerate highlights. The default is the function defined by the standard sRGB color space, which usually works well. (Its effects are similar to ??gamma=2.2.) Gifsicle uses gamma correction when choosing a color palette (??colors) and when dithering (??dither).【??:參數(shù)gamma將被設(shè)置為伽瑪校正,可以是實(shí)數(shù)或‘srgb’. 粗略地說,較高的數(shù)字?jǐn)U大陰影,較低的數(shù)字?jǐn)U大了亮點(diǎn).默認(rèn)值是標(biāo)準(zhǔn)sRGB顏色空間定義的函數(shù),通常效果很好. (它的效果類似于 ??gamma=2.2) Gifsicle在選擇調(diào)色板(??colors)和抖動(??dither)時使用伽馬校正。】

示例:gifsicle --gamma=200 -k 60 -i 2.gif -o test.gif

??change?color color1 color2

Change color1 to color2 in the following input GIFs. (The color arguments have the same forms as in the ?t option.) Change multiple colors by giving the option multiple times. Color changes don’t interfere with one another, so you can safely swap two colors with ‘??change?color color1 color2 ??change?color color2 color1’. They all take effect as an input GIF is read. ??no?change?color cancels all color changes.【??:在輸入GIF的中將參數(shù)color1更改為參數(shù)color2.(顏色數(shù)值與?t選項中的顏色數(shù)值相同). 通過多次提供選項來更改多種顏色.顏色變化不會相互干擾,因此您可以使用‘??change?color color1 color2 ??change?color color2 color1’安全地交換兩種顏色 ??no?change?color取消所有顏色變化】

示例:gifsicle --change-color #7ec31f #000000 -i 2.gif -o test.gif

??transform?colormap command

Command should be a shell command that reads from standard input and writes to standard output. Each colormap in the output GIF is translated into text colormap format (see ??use?colormap below) and piped to the command. The output that command generates (which should also be in text colormap format) will replace the input colormap. The replacement doesn’t consider color matching, so pixels that used color slot n in the input will still use color slot n in the output.【??:參數(shù)Command應(yīng)該是一個shell命令,它從標(biāo)準(zhǔn)輸入讀取并寫入標(biāo)準(zhǔn)輸出. 輸出GIF中的每個色彩映射都轉(zhuǎn)換為文本色彩映射格式(請參閱下面的??use?colormap)并通過管道傳輸?shù)矫? 命令生成的輸出(也應(yīng)采用文本色彩映射格式)將替換輸入的色彩映射.替換不考慮顏色匹配,因此在輸入中使用顏色槽n的像素仍將在輸出中使用顏色槽n.】

??use?colormap colormap

Change the image to use colormap. Each pixel in the image is changed to the closest match in colormap (or, if ??dither is on, to a dithered combination of colors in colormap). Colormap can be web for the 216-color “Web-safe palette”; gray for grayscale; bw for black-and-white; or the name of a file. That file should either be a text file
(the format is described below) or a GIF file, whose global colormap will be used. If ??colors=N is also given, an N?sized subset of colormap will be used.【??:使用參數(shù)colormap去更改圖像.圖像中的每個像素都會更改為色彩映射中最接近的匹配(或者,如果??dither是打開的,則為colormap中抖動的顏色組合). Colormap可以是用于216色“Web安全調(diào)色板”的Web;gray為灰度; bw為黑白; 或文件的名稱。該文件應(yīng)該是文本文件(格式如下所述)或GIF文件,將使用其全局色彩映射。 如果還給出了??colors=N,則將使用N?大小的色彩映射子集?!?/p>

示例:gifsicle --use-colormap bw -i 2.gif -o test.gif
示例:gifsicle --use-colormap gray -i 2.gif -o test.gif

Text colormap files use this format【??:(文本色彩映射文件使用此格式):

; 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

EXAMPLES(示例)[7]

First, let’s create an animation, ‘a(chǎn)nim.gif’:

gifsicle 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. Let’s slow it down and pause .5 seconds between frames, using the ??delay option.【??:這個動畫將非常快速地移動:由于我們沒有指定延遲,瀏覽器將盡可能快地循環(huán)遍歷幀。 讓我們放慢速度并在幀之間暫停.5秒,使用??delay選項.】

gifsicle ??delay 50 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 ?d 50 ??loop=3 a.gif b.gif c.gif d.gif > anim.gif

(Rather than type ??delay again, we used its short form, ?d. Many options have short forms; you can see them by running ‘gifsicle ??help’. We also abbreviated ??loopcount to ??loop, which is OK since no other option starts with ‘loop’.)【??:(而不是再次輸入??delay,我們使用它的簡短形式?d。許多選項都有簡短的形式;你可以通過運(yùn)行‘gifsicle ??help’看到它們。我們還將??loopcount 縮寫 ??loop,這是好的,因為沒有其他選項以‘loop’開頭。)】

To explode ‘a(chǎn)nim.gif’ into its component frames【??:(將‘a(chǎn)nim.gif’ 分解為其組成框架):】

gifsicle ??explode anim.gif ls anim.gif

anim.gif anim.gif.000 anim.gif.001 anim.gif.002 anim.gif.003

To optimize ‘a(chǎn)nim.gif’(優(yōu)化‘a(chǎn)nim.gif’):

gifsicle ?b ?O2 anim.gif

To change the second frame of ‘a(chǎn)nim.gif’ to ‘x.gif’【??:(將'anim.gif'的第二幀更改為'x.gif'):】

gifsicle ?b ??unoptimize ?O2 anim.gif ??replace "#1" x.gif

??unoptimize is used since ‘a(chǎn)nim.gif’ was optimized in the last step. Editing individual frames in optimized GIFs is dangerous without ??unoptimize; frames following the changed frame could be corrupted by the change. Of course, this might be what you want.【??:??unoptimize被使用,因為‘a(chǎn)nim.gif’ 在最后一步中被優(yōu)化了。 在沒有使用??unoptimize的情況下編輯優(yōu)化過的GIF中的各個幀是危險的; 更改幀后面的幀可能會被更改破壞。 當(dāng)然,這可能就是你想要的.】

Note that ??unoptimize and ??optimize can be on simultaneously. ??unoptimize affects input GIF files, while ??optimize affects output GIF files.【??:請注意??unoptimize??optimize可以同時打開。??unoptimize 影響輸入GIF文件,而??optimize影響輸出GIF文件.】

To print information about the first and fourth frames of ‘a(chǎn)nim.gif’【??:(打印有關(guān)‘a(chǎn)nim.gif’的第一幀和第四幀的信息):】

gifsicle ?I "#0" "#3" < anim.gif

To make black the transparent color in all the GIFs in the current directory, and also print information about each:【??:要在當(dāng)前目錄中的所有GIF中使黑色成為透明色,并打印有關(guān)每個GIF的信息:】

gifsicle ?bII ??trans "#000000" *.gif

Giving ?I twice forces normal output to occur. With only one ?I, the GIFs would not be modified.【??:這里?I兩次強(qiáng)制正常輸出。 只有一個?I,GIF不會被修改.】

To change ‘a(chǎn)nim.gif’ to use a 64-color subset of the Web-safe palette:【??:更改‘a(chǎn)nim.gif’以使用Web安全調(diào)色板的64色子集:】

gifsicle ?b ??colors=64 ??use?col=web anim.gif

To make a dithered black-and-white version of ‘a(chǎn)nim.gif’【??:(制作一個抖動的黑白版‘a(chǎn)nim.gif’):】

gifsicle ??dither ??use?col=bw anim.gif > anim-bw.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:【??:將一個GIF疊加在另一個上面??產(chǎn)生一幀輸出GIF,看起來像兩個輸入的疊加??使用gifsicle兩次:】

gifsicle bottom.gif top.gif | gifsicle ?U "#1" > result.gif


  1. NAME ?

  2. SYNOPSIS ?

  3. DESCRIPTION ?

  4. CONCEPT INDEX ?

  5. COMMAND LINE ?

  6. OPTIONS ?

  7. EXAMPLES ?

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 超高速音視頻編碼器用法: ffmpeg [options] [[infile options] -i infile...
    吉兇以情遷閱讀 4,818評論 0 4
  • 各位老師,各位家長早上好! 很榮幸能站在這里跟大家一塊討論教育孩子的問題。其實(shí)我不是一位合格的媽媽,從孩子上...
    蘋果杭媽閱讀 191評論 0 0
  • 我們很多的思維和行為模式都受我們內(nèi)在孩童的掌控,如果我們想掌握自己人生的方向盤,我們只需要相信這個改變的過程,并按...
    naionei閱讀 252評論 1 0
  • 銀笙嚶婉掠清風(fēng)。影伶仃,夜思濃。又遇良宵,恐看淚燭凝??v想攜歸同賞景,春草沒(mò),是多情。 而今明月照雙楓。彩...
    長夜無月閱讀 352評論 2 4
  • 每個人都有學(xué)生時代,而學(xué)生時代的寒暑假是學(xué)生們久久期盼的“放生”,這對于身為學(xué)生的姐妹倆也不例外! 姐妹倆是典型的...
    曦說閱讀 377評論 0 2

友情鏈接更多精彩內(nèi)容