img2webp
Stay organized with collections
Save and categorize content based on your preferences.
Name
img2webp
-- Create animated WebP file from a sequence of input images.
Synopsis
img2webp [file_options] [[frame_options] frame_file]...
img2webp argument_file_name
Description
img2webp
compresses a sequence of images using the animated WebP format. Input
images can either be PNG, JPEG, TIFF or WebP. If a single file name (not
starting with the character '-') is supplied as the argument, the command line
arguments are actually tokenized from this file. This allows for easy scripting
or using a large number of arguments.
File-level Options
The file-level options are applied at the beginning of the compression process,
before the input frames are read.
-o string
- Specify the name of the output WebP file.
-min_size
- Encode images to achieve smallest size. This disables key frame insertion
and picks the parameters resulting in the smallest output for each frame. It
uses lossless compression by default, but can be combined with
-q
, -m
,
-lossy
or -mixed
options.
-kmin int
-kmax int
- Specify the minimum and maximum distance between consecutive key frames
(independently decodable frames) in the output animation. The tool will
insert some key frames into the output animation as needed so that this
criteria is satisfied.
-mixed
- Mixed compression mode: optimize compression of the image by picking either
lossy or lossless compression for each frame heuristically. This global
option disables the local option
-lossy
and -lossless
.
-near_lossless int
- Specify the level of near-lossless image preprocessing. This option adjusts
pixel values to help compressibility, but has minimal impact on the visual
quality. It triggers lossless compression mode automatically. The range is 0
(maximum preprocessing) to 100 (no preprocessing, the default). The typical
value is around 60. Note that lossy with
-q 100
can at times yield better
results.
-sharp_yuv
- Use more accurate and sharper RGB->YUV conversion. Note that this process is
slower than the default 'fast' RGB->YUV conversion.
-loop int
- Specifies the number of times the animation should loop. Using
0
means
'loop indefinitely'.
-v
- Be more verbose.
-h, -help
- A short usage summary.
-version
- Print the version numbers of the relevant libraries used.
Per-frame Options
The per-frame options are applied for the images following as arguments in the
command line. They can be modified any number of times preceding each particular
input image.
-d int
- Specify the image duration in milliseconds.
-lossless, -lossy
- Compress the next image(s) using lossless or lossy compression mode. The
default mode is lossless.
-q float
- Specify the compression factor between 0 and 100. The default is 75.
-m int
- Specify the compression method to use. This parameter controls the trade off
between encoding speed and the compressed file size and quality. Possible
values range from 0 to 6. Default value is 4. When higher values are used,
the encoder will spend more time inspecting additional encoding
possibilities and decide on the quality gain. Lower value can result in
faster processing time at the expense of larger file size and lower
compression quality.
Bugs
Example
img2webp -loop 2 in0.png -lossy in1.jpg -d 80 in2.tiff -o out.webp
Authors
img2webp
is a part of libwebp
and was written by the WebP team. The latest
source tree is available at https://chromium.googlesource.com/webm/libwebp
This manual page was written by Pascal Massimino pascal.massimino@gmail.com
for the Debian project (and may be used by others).
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[null,null,["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eimg2webp\u003c/code\u003e is a command-line tool that creates animated WebP files from a sequence of PNG, JPEG, TIFF, or WebP images.\u003c/p\u003e\n"],["\u003cp\u003eIt offers various options for controlling compression, loop behavior, key frame insertion, and image quality.\u003c/p\u003e\n"],["\u003cp\u003eUsers can specify file-level options that apply to the entire animation and per-frame options for individual images.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eimg2webp\u003c/code\u003e supports both lossy and lossless compression modes and allows fine-tuning of compression parameters for optimal file size and quality.\u003c/p\u003e\n"],["\u003cp\u003eDetailed usage instructions, including options and examples, are provided in the documentation.\u003c/p\u003e\n"]]],["`img2webp` creates animated WebP files from image sequences (PNG, JPEG, TIFF, WebP). Key actions include setting file-level options like output filename (`-o`), minimum size (`-min_size`), keyframe distances (`-kmin`, `-kmax`), compression mode (`-mixed`, `-near_lossless`, `-sharp_yuv`), and loop count (`-loop`). Per-frame options include duration (`-d`), compression type (`-lossless`, `-lossy`), quality (`-q`), and method (`-m`). You can report bugs or submit patches at the provided links.\n"],null,["# img2webp\n\nName\n----\n\n`img2webp` -- Create animated WebP file from a sequence of input images.\n\nSynopsis\n--------\n\n`img2webp [file_options] [[frame_options] frame_file]...` \n\n`img2webp argument_file_name`\n\nDescription\n-----------\n\n`img2webp` compresses a sequence of images using the animated WebP format. Input\nimages can either be PNG, JPEG, TIFF or WebP. If a single file name (not\nstarting with the character '-') is supplied as the argument, the command line\narguments are actually tokenized from this file. This allows for easy scripting\nor using a large number of arguments.\n\nFile-level Options\n------------------\n\nThe file-level options are applied at the beginning of the compression process,\nbefore the input frames are read.\n\n`-o string`\n: Specify the name of the output WebP file.\n\n`-min_size`\n: Encode images to achieve smallest size. This disables key frame insertion\n and picks the parameters 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`-kmin int` \n`-kmax int`\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`-mixed`\n: Mixed compression mode: optimize compression of the image by picking either\n lossy or lossless compression for each frame heuristically. This global\n option disables the local option `-lossy` and `-lossless`.\n\n`-near_lossless int`\n: Specify the level of near-lossless image preprocessing. This option adjusts\n pixel values to help compressibility, but has minimal impact on the visual\n quality. It triggers lossless compression mode automatically. The range is 0\n (maximum preprocessing) to 100 (no preprocessing, the default). The typical\n value is around 60. Note that lossy with `-q 100` can at times yield better\n results.\n\n`-sharp_yuv`\n: Use more accurate and sharper RGB-\\\u003eYUV conversion. Note that this process is\n slower than the default 'fast' RGB-\\\u003eYUV conversion.\n\n`-loop int`\n: Specifies the number of times the animation should loop. Using `0` means\n 'loop indefinitely'.\n\n`-v`\n: Be more verbose.\n\n`-h, -help`\n: A short usage summary.\n\n`-version`\n: Print the version numbers of the relevant libraries used.\n\nPer-frame Options\n-----------------\n\nThe per-frame options are applied for the images following as arguments in the\ncommand line. They can be modified any number of times preceding each particular\ninput image.\n\n`-d int`\n: Specify the image duration in milliseconds.\n\n`-lossless, -lossy`\n: Compress the next image(s) using lossless or lossy compression mode. The\n default mode is lossless.\n\n`-q float`\n: Specify the compression factor between 0 and 100. The default is 75.\n\n`-m int`\n: Specify the compression method to use. This parameter controls the trade off\n between encoding speed and the compressed file size and quality. Possible\n values range from 0 to 6. Default value is 4. When higher values are used,\n the encoder will spend more time inspecting additional encoding\n possibilities and decide on the quality gain. Lower value can result in\n faster processing time at the expense of larger file size and lower\n compression quality.\n\nBugs\n----\n\n- Please report all bugs to the 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\nExample\n-------\n\n img2webp -loop 2 in0.png -lossy in1.jpg -d 80 in2.tiff -o out.webp\n\nAuthors\n-------\n\n`img2webp` is a part of `libwebp` and was written by the WebP team. The latest\nsource tree is available at \u003chttps://chromium.googlesource.com/webm/libwebp\u003e\n\nThis manual page was written by Pascal Massimino [pascal.massimino@gmail.com](mailto:pascal.massimino@gmail.com)\nfor the Debian project (and may be used by others)."]]