gif2webp
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
名稱
gif2webp
:將 GIF 圖片轉換為 WebP
Synopsis
gif2webp [options] input_file.gif -o output_file.webp
說明
gif2webp
可將 GIF 圖片轉換成 WebP 圖片。
選項
基本選項包括:
-o string
- 指定輸出 WebP 檔案名稱。如果您省略這項資訊,「
gif2webp
」會
執行轉換但只記錄統計資料。
使用「-」做為輸出名稱,這樣輸出至「stdout」即可。
-- string
- 明確指定輸入檔案。如果輸入內容
檔案開頭為「-」。這個選項必須顯示在「最後一個」區塊。
並忽略此後的所有其他選項。如果輸入檔案是「-」,
系統會從「stdin」而不是檔案
-h, -help
- 使用資訊
-version
- 顯示版本號碼 (以 primary.minor.revision) 顯示,然後結束。
-lossy
- 使用有損壓縮技術編碼圖片。
-mixed
- 混合壓縮模式:選擇不同選項,最佳化圖片壓縮方式
每個影格都會有損壓縮或無損壓縮。
-q float
- 指定
0
和 100
之間的 RGB 管道壓縮係數。
預設值為 75
。在無損壓縮 (預設) 的情況下,小因素會
可提高壓縮速度,但產生的檔案更大最大
壓縮是使用 100
的值來達成。有損傷時
壓縮 (由 -lossy 選項指定) 會產生一個小因子
畫質較低的檔案會利用值來達到最佳品質
(共 100
個)。
-min_size
- 對圖片進行編碼以縮小尺寸。這麼做會停用按鍵影格插入功能,以及
挑選產生每個影格最小輸出內容的丟棄方法。這項服務
預設使用無損壓縮,但可與
-q
、-m
、
-lossy
或 -mixed
選項。
-m int
- 指定要使用的壓縮方法。這個參數可控制
。
可能的值介於
0
到 6
之間。預設值為 4
。時間越高
編碼器會花費較多時間檢查
找出可能的編碼方式,然後再決定品質增幅。較低的值可以
不但加快處理時間,還可能會增加檔案大小
壓縮品質較低
-kmin int
、-kmax int
指定連續按鍵影格之間的最小和最大距離
(可單獨分離的影格)。這項工具
視需要在輸出動畫中插入幾個主要影格
是否符合條件
如果 kmax
的值為 0
,系統會關閉插入主要影格的功能。kmax
值
1
會使所有影格成為主要影格。kmin
的值不是
都須注意這一點一般值位於
範圍:3
到 30
。預設值為 kmin
= 9
,kmax
= 17
無損壓縮,kmin
= 3
,kmax
= 5
代表有損壓縮。
這兩種選項僅適用於具有大量數量的動畫圖片
影格速率 (>50 個)。
如果使用的值較低,系統會將更多影格轉換成主要影格。
這可能會導致減少需要為影格解碼所需的影格數量
進而改善解碼器的效能但這可能會導致
檔案大小稍微大一點值越大可能導致解碼效果越差
但檔案大小較小
一些限制:
- 公里 <kmax
- 公里 >= kmax / 2 + 1;和
- kmax - kmin <= 30.
如未符合上述任一限制,就會強制執行
。
-metadata string
出現下列情況時,要從輸入複製到輸出內容的中繼資料清單 (以半形逗號分隔)
。有效值:all
、none
、icc
、xmp
。預設為 xmp
。
-f int
僅適用於有損編碼 (由 -lossy
選項指定)。請指定
「取消封鎖」篩選器的強度,介於 0
(無篩選) 和 100
之間
(最大篩選)。將值設為 0
會停用任何篩選功能。較高
值就會提高套用篩選程序的強度
解碼器成了模型值越大,畫面越平順
顯示。一般值通常介於 20
到 50
之間。
-mt
如果可以,請使用多執行緒進行編碼。
-loop_compatibility
啟用後,請以與 Chrome 相容的相容方式處理迴圈資訊
早於 M62 (包含) 和 Firefox 之前的版本。
-v
列印額外資訊。
-quiet
不列印任何資料。
錯誤
範例
gif2webp picture.gif -o picture.webp
gif2webp -q 70 picture.gif -o picture.webp
gif2webp -lossy -m 3 picture.gif -o picture_lossy.webp
gif2webp -lossy -f 50 picture.gif -o picture.webp
gif2webp -min_size -q 30 -o picture.webp -- ---picture.gif
cat picture.gif | gif2webp -o - -- - > output.webp
作者
gif2webp
是 libwebp
的一部分,由 WebP 團隊撰寫。
最新原始碼樹狀結構位於
https://chromium.googlesource.com/webm/libwebp/
本手冊由 Urvang Joshi urvang@google.com 撰寫,
Debian 專案 (也可能供他人使用)。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[null,null,["上次更新時間:2025-08-08 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003egif2webp\u003c/code\u003e is a command-line tool used to convert GIF images to the WebP format, potentially offering better compression and quality.\u003c/p\u003e\n"],["\u003cp\u003eUsers can adjust compression parameters like quality (\u003ccode\u003e-q\u003c/code\u003e), lossy/lossless encoding (\u003ccode\u003e-lossy\u003c/code\u003e, \u003ccode\u003e-lossless\u003c/code\u003e), and methods (\u003ccode\u003e-m\u003c/code\u003e) for customized output.\u003c/p\u003e\n"],["\u003cp\u003eAdvanced options allow control over key frames (\u003ccode\u003e-kmin\u003c/code\u003e, \u003ccode\u003e-kmax\u003c/code\u003e), metadata handling (\u003ccode\u003e-metadata\u003c/code\u003e), and deblocking filter (\u003ccode\u003e-f\u003c/code\u003e) for fine-tuning.\u003c/p\u003e\n"],["\u003cp\u003eThe tool supports multi-threading (\u003ccode\u003e-mt\u003c/code\u003e) and offers options for compatibility with older browsers (\u003ccode\u003e-loop_compatibility\u003c/code\u003e) and controlling output verbosity (\u003ccode\u003e-v\u003c/code\u003e, \u003ccode\u003e-quiet\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eDetailed usage instructions, including examples and bug reporting information, are provided in the documentation.\u003c/p\u003e\n"]]],["`gif2webp` converts GIF images to WebP format using the command `gif2webp [options] input_file.gif -o output_file.webp`. Key actions include specifying output file names (`-o`), setting compression quality (`-q`), choosing between lossy (`-lossy`) or mixed (`-mixed`) compression, optimizing for minimum size (`-min_size`), adjusting compression methods (`-m`), and setting keyframe intervals (`-kmin`, `-kmax`). Multi-threading (`-mt`) and metadata copying (`-metadata`) are also available. The tool also support standard input and output redirection.\n"],null,["# gif2webp\n\nName\n----\n\n`gif2webp` -- Convert a GIF image to WebP\n\nSynopsis\n--------\n\n`gif2webp [options] input_file.gif -o output_file.webp`\n\nDescription\n-----------\n\n`gif2webp` converts a GIF image to a WebP image.\n\nOptions\n-------\n\nThe basic options are:\n\n`-o string`\n: Specify the name of the output WebP file. If omitted, `gif2webp` will\n perform conversion but only report statistics.\n Using \"-\" as output name will direct output to 'stdout'.\n\n`-- string`\n: Explicitly specify the input file. This option is useful if the input\n file starts with an \"-\" for instance. This option must appear **last**.\n Any other options afterward will be ignored. If the input file is \"-\",\n the data will be read from 'stdin' instead of a file.\n\n`-h, -help`\n: Usage information\n\n`-version`\n: Print the version number (as major.minor.revision) and exit.\n\n`-lossy`\n: Encode the image using lossy compression.\n\n`-mixed`\n: Mixed compression mode: optimize compression of the image by picking\n either lossy or lossless compression for each frame heuristically.\n\n`-q float`\n: Specify the compression factor for RGB channels between `0` and `100`. The\n default is `75`. In case of lossless compression (default), a small factor\n enables faster compression speed, but produces a larger file. Maximum\n compression is achieved by using a value of `100`. In case of lossy\n compression (specified by the -lossy option), a small factor produces a\n smaller file with lower quality. Best quality is achieved by using a value\n of `100`.\n\n`-min_size`\n: Encode image to achieve smallest size. This disables key frame insertion and\n picks the dispose method resulting in the smallest output for each frame. It\n uses lossless compression by default, but can be combined with `-q`, `-m`,\n `-lossy` or `-mixed` options.\n\n`-m int`\n: Specify the compression method to use. This parameter controls the trade\n off between encoding speed and the compressed file size and quality.\n Possible values range from `0` to `6`. Default value is `4`. When higher\n values are used, the encoder will spend more time inspecting additional\n encoding possibilities and decide on the quality gain. Lower value can\n result in faster processing time at the expense of larger file size and\n lower compression quality.\n\n`-kmin int`, `-kmax int`\n\n: Specify the minimum and maximum distance between consecutive key frames\n (independently decodable frames) in the output animation. The tool will\n insert some key frames into the output animation as needed so that this\n criteria is satisfied.\n\n A `kmax` value of `0` will turn off insertion of key frames. A `kmax` value\n of `1` will result in all frames being key frames. `kmin` value is not\n taken into account in both these special cases. Typical values are in the\n range `3` to `30`. Default values are `kmin` = `9`, `kmax` = `17` for\n lossless compression and `kmin` = `3`, `kmax` = `5` for lossy compression.\n\n These two options are relevant only for animated images with large number\n of frames (\\\u003e50).\n\n When lower values are used, more frames will be converted to key frames.\n This may lead to smaller number of frames required to decode a frame on\n average, thereby improving the decoding performance. But this may lead to\n slightly bigger file sizes. Higher values may lead to worse decoding\n performance, but smaller file sizes.\n\n Some restrictions:\n\n - kmin \\\u003c kmax,\n - kmin \\\u003e= kmax / 2 + 1; and\n - kmax - kmin \\\u003c= 30.\n\n If any of these restrictions are not met, they will be enforced\n automatically.\n\n`-metadata string`\n\n: A comma separated list of metadata to copy from the input to the output if\n present. Valid values: `all`, `none`, `icc`, `xmp`. The default is `xmp`.\n\n`-f int`\n\n: For lossy encoding only (specified by the `-lossy` option). Specify the\n strength of the deblocking filter, between `0` (no filtering) and `100`\n (maximum filtering). A value of `0` will turn off any filtering. Higher\n value will increase the strength of the filtering process applied after\n decoding the picture. The higher the value the smoother the picture will\n appear. Typical values are usually in the range of `20` to `50`.\n\n`-mt`\n\n: Use multi-threading for encoding, if possible.\n\n`-loop_compatibility`\n\n: If enabled, handle the loop information in a compatible fashion for Chrome\n version prior to M62 (inclusive) and Firefox.\n\n`-v`\n\n: Print extra information.\n\n`-quiet`\n\n: Do not print anything.\n\nBugs\n----\n\n- Please report all bugs to our issue tracker: \u003chttps://issues.webmproject.org\u003e\n\n- Patches welcome! See this page to get started: \u003chttps://www.webmproject.org/code/contribute/submitting-patches/\u003e\n\nExamples\n--------\n\n gif2webp picture.gif -o picture.webp\n gif2webp -q 70 picture.gif -o picture.webp\n gif2webp -lossy -m 3 picture.gif -o picture_lossy.webp\n gif2webp -lossy -f 50 picture.gif -o picture.webp\n gif2webp -min_size -q 30 -o picture.webp -- ---picture.gif\n cat picture.gif | gif2webp -o - -- - \u003e output.webp\n\nAuthors\n-------\n\n`gif2webp` is part of `libwebp`, and was written by the WebP team.\nThe latest source tree is available at\n\u003chttps://chromium.googlesource.com/webm/libwebp/\u003e\n\nThis manual page was written by Urvang Joshi [urvang@google.com](mailto:urvang@google.com), for the\nDebian project (and may be used by others)."]]