gif2webp
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
名称
gif2webp
- 将 GIF 图片转换为 WebP 格式
摘要
gif2webp [options] input_file.gif -o output_file.webp
说明
gif2webp
可将 GIF 图片转换为 WebP 图片。
选项
基本选项包括:
-o string
- 指定 WebP 输出文件的名称。如果省略,
gif2webp
将
执行转化,但只报告统计信息。
使用“-”作为输出名称,会将输出定向到“stdout”。
-- string
- 明确指定输入文件。如果输入
文件以“-”开头例如此选项必须显示为最后。
之后的任何其他选项都将被忽略。如果输入文件为“-”,
数据将从“stdin”中读取数据而不是文件。
-h, -help
- 使用情况信息
-version
- 输出版本号(采用 main.minor.revision 格式)并退出。
-lossy
- 使用有损压缩对图片进行编码。
-mixed
- 混合压缩模式:通过选择内容来优化图片的压缩
采用启发式方式为每个帧进行有损或无损压缩。
-q float
- 用于指定介于
0
和 100
之间的 RGB 通道的压缩系数。通过
默认值为 75
。如果是无损压缩(默认),一个小因素
可加快压缩速度,但生成的文件较大。上限
可以通过使用值 100
来实现压缩。有损
压缩(由 -lossy 选项指定),一个小系数会生成一个
文件越小,画质却越低指定值有助于实现最佳画质
共 100
页。
-min_size
- 对图片进行编码以达到最小尺寸。这会停用关键帧插入功能
选择让每一帧获得最小输出的 dispose 方法。它
默认使用无损压缩,但可以与
-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 项目(可能被其他人使用)。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-08。
[null,null,["最后更新时间 (UTC):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)."]]