1CWEBP(1) General Commands Manual CWEBP(1)
2
3
4
6 cwebp - compress an image file to a WebP file
7
9 cwebp [options] input_file -o output_file.webp
10
12 This manual page documents the cwebp command.
13
14 cwebp compresses an image using the WebP format. Input format can be
15 either PNG, JPEG, TIFF or raw Y'CbCr samples.
16
18 The basic options are:
19
20 -o string
21 Specify the name of the output WebP file. If omitted, cwebp will
22 perform compression but only report statistics.
23
24 -h, -help
25 A short usage summary.
26
27 -H, -longhelp
28 A summary of all the possible options.
29
30 -version
31 Print the version number (as major.minor.revision) and exit.
32
33 -q float
34 Specify the compression factor for RGB channels between 0 and
35 100. The default is 75.
36 In case of lossy compression (default), a small factor produces
37 a smaller file with lower quality. Best quality is achieved by
38 using a value of 100.
39 In case of lossless compression (specified by the -lossless
40 option), a small factor enables faster compression speed, but
41 produces a larger file. Maximum compression is achieved by using
42 a value of 100.
43
44 -alpha_q int
45 Specify the compression factor for alpha compression between 0
46 and 100. Lossless compression of alpha is achieved using a
47 value of 100, while the lower values result in a lossy compres‐
48 sion. The default is 100.
49
50 -f int Specify the strength of the deblocking filter, between 0 (no
51 filtering) and 100 (maximum filtering). A value of 0 will turn
52 off any filtering. Higher value will increase the strength of
53 the filtering process applied after decoding the picture. The
54 higher the value the smoother the picture will appear. Typical
55 values are usually in the range of 20 to 50.
56
57 -preset string
58 Specify a set of pre-defined parameters to suit a particular
59 type of source material. Possible values are: default, photo,
60 picture, drawing, icon, text. Since -preset overwrites the other
61 parameters' values (except the -q one), this option should
62 preferably appear first in the order of the arguments.
63
64 -sns int
65 Specify the amplitude of the spatial noise shaping. Spatial
66 noise shaping (or sns for short) refers to a general collection
67 of built-in algorithms used to decide which area of the picture
68 should use relatively less bits, and where else to better trans‐
69 fer these bits. The possible range goes from 0 (algorithm is
70 off) to 100 (the maximal effect). The default value is 80.
71
72 -m int Specify the compression method to use. This parameter controls
73 the trade off between encoding speed and the compressed file
74 size and quality. Possible values range from 0 to 6. Default
75 value is 4. When higher values are used, the encoder will spend
76 more time inspecting additional encoding possibilities and
77 decide on the quality gain. Lower value can result is faster
78 processing time at the expense of larger file size and lower
79 compression quality.
80
81 -jpeg_like
82 Change the internal parameter mapping to better match the
83 expected size of JPEG compression. This flag will generally pro‐
84 duce an output file of similar size to its JPEG equivalent (for
85 the same -q setting), but with less visual distortion.
86
87 -mt Use multi-threading for encoding, if possible. This option is
88 only effective when using lossy compression on a source with a
89 transparency channel.
90
91 -low_memory
92 Reduce memory usage of lossy encoding by saving four times the
93 compressed size (typically). This will make the encoding slower
94 and the output slightly different in size and distortion. This
95 flag is only effective for methods 3 and up, and is off by
96 default. Note that leaving this flag off will have some side
97 effects on the bitstream: it forces certain bitstream features
98 like number of partitions (forced to 1). Note that a more
99 detailed report of bitstream size is printed by cwebp when using
100 this option.
101
102 -af Turns auto-filter on. This algorithm will spend additional time
103 optimizing the filtering strength to reach a well-balanced qual‐
104 ity.
105
106
108 More advanced options are:
109
110 -sharpness int
111 Specify the sharpness of the filtering (if used). Range is 0
112 (sharpest) to 7 (least sharp). Default is 0.
113
114 -strong
115 Use strong filtering (if filtering is being used thanks to the
116 -f option). Strong filtering is on by default.
117
118 -nostrong
119 Disable strong filtering (if filtering is being used thanks to
120 the -f option) and use simple filtering instead.
121
122 -segments int
123 Change the number of partitions to use during the segmentation
124 of the sns algorithm. Segments should be in range 1 to 4.
125 Default value is 4. This option has no effect for methods 3 and
126 up, unless -low_memory is used.
127
128 -partition_limit int
129 Degrade quality by limiting the number of bits used by some mac‐
130 roblocks. Range is 0 (no degradation, the default) to 100 (full
131 degradation). Useful values are usually around 30-70 for moder‐
132 ately large images. In the VP8 format, the so-called control
133 partition has a limit of 512k and is used to store the following
134 information: whether the macroblock is skipped, which segment it
135 belongs to, whether it is coded as intra 4x4 or intra 16x16
136 mode, and finally the prediction modes to use for each of the
137 sub-blocks. For a very large image, 512k only leaves room to
138 few bits per 16x16 macroblock. The absolute minimum is 4 bits
139 per macroblock. Skip, segment, and mode information can use up
140 almost all these 4 bits (although the case is unlikely), which
141 is problematic for very large images. The partition_limit factor
142 controls how frequently the most bit-costly mode (intra 4x4)
143 will be used. This is useful in case the 512k limit is reached
144 and the following message is displayed: Error code: 6 (PARTI‐
145 TION0_OVERFLOW: Partition #0 is too big to fit 512k). If using
146 -partition_limit is not enough to meet the 512k constraint, one
147 should use less segments in order to save more header bits per
148 macroblock. See the -segments option.
149
150 -size int
151 Specify a target size (in bytes) to try and reach for the com‐
152 pressed output. Compressor will make several pass of partial
153 encoding in order to get as close as possible to this target.
154
155 -psnr float
156 Specify a target PSNR (in dB) to try and reach for the com‐
157 pressed output. Compressor will make several pass of partial
158 encoding in order to get as close as possible to this target.
159
160 -pass int
161 Set a maximum number of passes to use during the dichotomy used
162 by options -size or -psnr. Maximum value is 10.
163
164 -crop x_position y_position width height
165 Crop the source to a rectangle with top-left corner at coordi‐
166 nates (x_position, y_position) and size width x height. This
167 cropping area must be fully contained within the source rectan‐
168 gle.
169
170 -s width height
171 Specify that the input file actually consists of raw Y'CbCr sam‐
172 ples following the ITU-R BT.601 recommendation, in 4:2:0 linear
173 format. The luma plane has size width x height.
174
175 -map int
176 Output additional ASCII-map of encoding information. Possible
177 map values range from 1 to 6. This is only meant to help debug‐
178 ging.
179
180 -pre int
181 Specify a pre-processing filter. This option is a placeholder
182 and has currently no effect.
183
184 -alpha_filter string
185 Specify the predictive filtering method for the alpha plane. One
186 of 'none', 'fast' or 'best', in increasing complexity and slow‐
187 ness order. Default is 'fast'. Internally, alpha filtering is
188 performed using four possible predictions (none, horizontal,
189 vertical, gradient). The 'best' mode will try each mode in turn
190 and pick the one which gives the smaller size. The 'fast' mode
191 will just try to form an a-priori guess without testing all
192 modes.
193
194 -alpha_method int
195 Specify the algorithm used for alpha compression: 0 or 1. Algo‐
196 rithm 0 denotes no compression, 1 uses WebP lossless format for
197 compression. The default is 1.
198
199 -alpha_cleanup
200 Modify unseen RGB values under fully transparent area, to help
201 compressibility. The default is off.
202
203 -noalpha
204 Using this option will discard the alpha channel.
205
206 -lossless
207 Encode the image without any loss.
208
209 -hint string
210 Specify the hint about input image type. Possible values are:
211 photo, picture or graph.
212
213 -metadata string
214 A comma separated list of metadata to copy from the input to the
215 output if present. Valid values: all, none, exif, icc, xmp.
216 The default is none.
217
218 Note: each input format may not support all combinations.
219
220 -noasm Disable all assembly optimizations.
221
222 -v Print extra information (encoding time in particular).
223
224 -print_psnr
225 Compute and report average PSNR (Peak-Signal-To-Noise ratio).
226
227 -print_ssim
228 Compute and report average SSIM (structural similarity metric,
229 see http://en.wikipedia.org/wiki/SSIM for additional details).
230
231 -print_lsim
232 Compute and report local similarity metric (sum of lowest error
233 amongst the collocated pixel neighbors).
234
235 -progress
236 Report encoding progress in percent.
237
238 -quiet Do not print anything.
239
240 -short Only print brief information (output file size and PSNR) for
241 testing purpose.
242
243
245 Please report all bugs to our issue tracker:
246 http://code.google.com/p/webp/issues
247 Patches welcome! See this page to get started: http://www.webmpro‐
248 ject.org/code/contribute/submitting-patches/
249
250
252 cwebp -q 50 -lossless picture.png -o picture_lossless.webp
253 cwebp -q 70 picture_with_alpha.png -o picture_with_alpha.webp
254 cwebp -sns 70 -f 50 -size 60000 picture.png -o picture.webp
255
256
258 cwebp was written by the WebP team.
259 The latest source tree is available at http://www.webmproject.org/code
260
261 This manual page was written by Pascal Massimino <pascal.mas‐
262 simino@gmail.com>, for the Debian project (and may be used by others).
263
264
266 dwebp(1), gif2webp(1).
267 Please refer to http://developers.google.com/speed/webp/ for additional
268 information.
269
270
271
272 March 13, 2013 CWEBP(1)