Debian Codegraph @

libwebp_src/man/cwebp.1

raw
1 .\" Hey, EMACS: -*- nroff -*-
2 .TH CWEBP 1 "March 26, 2024"
3 .SH NAME
4 cwebp \- compress an image file to a WebP file
5 .SH SYNOPSIS
6 .B cwebp
7 .RI [ options ] " input_file \-o output_file.webp
8 .br
9 .SH DESCRIPTION
10 This manual page documents the
11 .B cwebp
12 command.
13 .PP
14 \fBcwebp\fP compresses an image using the WebP format.
15 Input format can be either PNG, JPEG, TIFF, WebP or raw Y'CbCr samples.
16 Note: Animated PNG and WebP files are not supported.
17 .SH OPTIONS
18 The basic options are:
19 .TP
20 .BI \-o " string
21 Specify the name of the output WebP file. If omitted, \fBcwebp\fP will
22 perform compression but only report statistics.
23 Using "\-" as output name will direct output to 'stdout'.
24 .TP
25 .BI \-\- " string
26 Explicitly specify the input file. This option is useful if the input
27 file starts with a '\-' for instance. This option must appear \fBlast\fP.
28 Any other options afterward will be ignored.
29 .TP
30 .B \-h, \-help
31 A short usage summary.
32 .TP
33 .B \-H, \-longhelp
34 A summary of all the possible options.
35 .TP
36 .B \-version
37 Print the version number (as major.minor.revision) and exit.
38 .TP
39 .B \-lossless
40 Encode the image without any loss. For images with fully transparent area,
41 the invisible pixel values (R/G/B or Y/U/V) will be preserved only if the
42 \-exact option is used.
43 .TP
44 .BI \-near_lossless " int
45 Specify the level of near\-lossless image preprocessing. This option adjusts
46 pixel values to help compressibility, but has minimal impact on the visual
47 quality. It triggers lossless compression mode automatically. The range is 0
48 (maximum preprocessing) to 100 (no preprocessing, the default). The typical
49 value is around 60. Note that lossy with \fB\-q 100\fP can at times yield
50 better results.
51 .TP
52 .BI \-q " float
53 Specify the compression factor for RGB channels between 0 and 100. The default
54 is 75.
55 .br
56 In case of lossy compression (default), a small factor produces a smaller file
57 with lower quality. Best quality is achieved by using a value of 100.
58 .br
59 In case of lossless compression (specified by the \fB\-lossless\fP option), a
60 small factor enables faster compression speed, but produces a larger file.
61 Maximum compression is achieved by using a value of 100.
62 .TP
63 .BI \-z " int
64 Switch on \fBlossless\fP compression mode with the specified level between 0
65 and 9, with level 0 being the fastest, 9 being the slowest. Fast mode
66 produces larger file size than slower ones. A good default is \fB\-z 6\fP.
67 This option is actually a shortcut for some predefined settings for quality
68 and method. If options \fB\-q\fP or \fB\-m\fP are subsequently used, they will
69 invalidate the effect of this option.
70 .TP
71 .BI \-alpha_q " int
72 Specify the compression factor for alpha compression between 0 and 100.
73 Lossless compression of alpha is achieved using a value of 100, while the lower
74 values result in a lossy compression. The default is 100.
75 .TP
76 .BI \-preset " string
77 Specify a set of pre\-defined parameters to suit a particular type of
78 source material. Possible values are: \fBdefault\fP, \fBphoto\fP,
79 \fBpicture\fP, \fBdrawing\fP, \fBicon\fP, \fBtext\fP. Since
80 \fB\-preset\fP overwrites the other parameters' values (except the
81 \fB\-q\fP one), this option should preferably appear first in the
82 order of the arguments.
83 .TP
84 .BI \-m " int
85 Specify the compression method to use. This parameter controls the
86 trade off between encoding speed and the compressed file size and quality.
87 Possible values range from 0 to 6. Default value is 4.
88 When higher values are used, the encoder will spend more time inspecting
89 additional encoding possibilities and decide on the quality gain.
90 Lower value can result in faster processing time at the expense of
91 larger file size and lower compression quality.
92 .TP
93 .BI \-crop " x_position y_position width height
94 Crop the source to a rectangle with top\-left corner at coordinates
95 (\fBx_position\fP, \fBy_position\fP) and size \fBwidth\fP x \fBheight\fP.
96 This cropping area must be fully contained within the source rectangle.
97 Note: the cropping is applied \fIbefore\fP any scaling.
98 .TP
99 .BI \-resize " width height
100 Resize the source to a rectangle with size \fBwidth\fP x \fBheight\fP.
101 If either (but not both) of the \fBwidth\fP or \fBheight\fP parameters is 0,
102 the value will be calculated preserving the aspect\-ratio. Note: scaling
103 is applied \fIafter\fP cropping.
104 .TP
105 .B \-mt
106 Use multi\-threading for encoding, if possible.
107 .TP
108 .B \-low_memory
109 Reduce memory usage of lossy encoding by saving four times the compressed
110 size (typically). This will make the encoding slower and the output slightly
111 different in size and distortion. This flag is only effective for methods
112 3 and up, and is off by default. Note that leaving this flag off will have
113 some side effects on the bitstream: it forces certain bitstream features
114 like number of partitions (forced to 1). Note that a more detailed report
115 of bitstream size is printed by \fBcwebp\fP when using this option.
116
117 .SS LOSSY OPTIONS
118 These options are only effective when doing lossy encoding (the default, with
119 or without alpha).
120
121 .TP
122 .BI \-size " int
123 Specify a target size (in bytes) to try and reach for the compressed output.
124 The compressor will make several passes of partial encoding in order to get as
125 close as possible to this target. If both \fB\-size\fP and \fB\-psnr\fP
126 are used, \fB\-size\fP value will prevail.
127 .TP
128 .BI \-psnr " float
129 Specify a target PSNR (in dB) to try and reach for the compressed output.
130 The compressor will make several passes of partial encoding in order to get as
131 close as possible to this target. If both \fB\-size\fP and \fB\-psnr\fP
132 are used, \fB\-size\fP value will prevail.
133 .TP
134 .BI \-pass " int
135 Set a maximum number of passes to use during the dichotomy used by
136 options \fB\-size\fP or \fB\-psnr\fP. Maximum value is 10, default is 1.
137 If options \fB\-size\fP or \fB\-psnr\fP were used, but \fB\-pass\fP wasn't
138 specified, a default value of '6' passes will be used. If \fB\-pass\fP is
139 specified, but neither \fB-size\fP nor \fB-psnr\fP are, a target PSNR of 40dB
140 will be used.
141 .TP
142 .BI \-qrange " int int
143 Specifies the permissible interval for the quality factor. This is particularly
144 useful when using multi-pass (\fB\-size\fP or \fB\-psnr\fP options).
145 Default is 0 100.
146 If the quality factor is outside this range, it will be clamped.
147 If the minimum value must be less or equal to the maximum one.
148 .TP
149 .B \-af
150 Turns auto\-filter on. This algorithm will spend additional time optimizing
151 the filtering strength to reach a well\-balanced quality.
152 .TP
153 .B \-jpeg_like
154 Change the internal parameter mapping to better match the expected size
155 of JPEG compression. This flag will generally produce an output file of
156 similar size to its JPEG equivalent (for the same \fB\-q\fP setting), but
157 with less visual distortion.
158
159 .TP
160 Advanced options:
161
162 .TP
163 .BI \-f " int
164 Specify the strength of the deblocking filter, between 0 (no filtering)
165 and 100 (maximum filtering). A value of 0 will turn off any filtering.
166 Higher value will increase the strength of the filtering process applied
167 after decoding the picture. The higher the value the smoother the picture will
168 appear. Typical values are usually in the range of 20 to 50.
169 .TP
170 .BI \-sharpness " int
171 Specify the sharpness of the filtering (if used).
172 Range is 0 (sharpest) to 7 (least sharp). Default is 0.
173 .TP
174 .B \-strong
175 Use strong filtering (if filtering is being used thanks to the
176 \fB\-f\fP option). Strong filtering is on by default.
177 .TP
178 .B \-nostrong
179 Disable strong filtering (if filtering is being used thanks to the
180 \fB\-f\fP option) and use simple filtering instead.
181 .TP
182 .B \-sharp_yuv
183 Use more accurate and sharper RGB->YUV conversion if needed. Note that this
184 process is slower than the default 'fast' RGB->YUV conversion.
185 .TP
186 .BI \-sns " int
187 Specify the amplitude of the spatial noise shaping. Spatial noise shaping
188 (or \fBsns\fP for short) refers to a general collection of built\-in algorithms
189 used to decide which area of the picture should use relatively less bits,
190 and where else to better transfer these bits. The possible range goes from
191 0 (algorithm is off) to 100 (the maximal effect). The default value is 50.
192 .TP
193 .BI \-segments " int
194 Change the number of partitions to use during the segmentation of the
195 sns algorithm. Segments should be in range 1 to 4. Default value is 4.
196 This option has no effect for methods 3 and up, unless \fB\-low_memory\fP
197 is used.
198 .TP
199 .BI \-partition_limit " int
200 Degrade quality by limiting the number of bits used by some macroblocks.
201 Range is 0 (no degradation, the default) to 100 (full degradation).
202 Useful values are usually around 30\-70 for moderately large images.
203 In the VP8 format, the so\-called control partition has a limit of 512k and
204 is used to store the following information: whether the macroblock is skipped,
205 which segment it belongs to, whether it is coded as intra 4x4 or intra 16x16
206 mode, and finally the prediction modes to use for each of the sub\-blocks.
207 For a very large image, 512k only leaves room for a few bits per 16x16
208 macroblock.
209 The absolute minimum is 4 bits per macroblock. Skip, segment, and mode
210 information can use up almost all these 4 bits (although the case is unlikely),
211 which is problematic for very large images. The partition_limit factor controls
212 how frequently the most bit\-costly mode (intra 4x4) will be used. This is
213 useful in case the 512k limit is reached and the following message is displayed:
214 \fIError code: 6 (PARTITION0_OVERFLOW: Partition #0 is too big to fit 512k)\fP.
215 If using \fB\-partition_limit\fP is not enough to meet the 512k constraint, one
216 should use less segments in order to save more header bits per macroblock.
217 See the \fB\-segments\fP option. Note the \fB-m\fP and \fB-q\fP options also
218 influence the encoder's decisions and ability to hit this limit.
219
220 .SS LOGGING OPTIONS
221 These options control the level of output:
222 .TP
223 .B \-v
224 Print extra information (encoding time in particular).
225 .TP
226 .B \-print_psnr
227 Compute and report average PSNR (Peak\-Signal\-To\-Noise ratio).
228 .TP
229 .B \-print_ssim
230 Compute and report average SSIM (structural similarity
231 metric, see https://en.wikipedia.org/wiki/SSIM for additional details).
232 .TP
233 .B \-print_lsim
234 Compute and report local similarity metric (sum of lowest error amongst the
235 collocated pixel neighbors).
236 .TP
237 .B \-progress
238 Report encoding progress in percent.
239 .TP
240 .B \-quiet
241 Do not print anything.
242 .TP
243 .B \-short
244 Only print brief information (output file size and PSNR) for testing purposes.
245 .TP
246 .BI \-map " int
247 Output additional ASCII\-map of encoding information. Possible map values
248 range from 1 to 6. This is only meant to help debugging.
249
250 .SS ADDITIONAL OPTIONS
251 More advanced options are:
252 .TP
253 .BI \-s " width height
254 Specify that the input file actually consists of raw Y'CbCr samples following
255 the ITU\-R BT.601 recommendation, in 4:2:0 linear format.
256 The luma plane has size \fBwidth\fP x \fBheight\fP.
257 .TP
258 .BI \-pre " int
259 Specify some preprocessing steps. Using a value of '2' will trigger
260 quality\-dependent pseudo\-random dithering during RGBA\->YUVA conversion
261 (lossy compression only).
262 .TP
263 .BI \-alpha_filter " string
264 Specify the predictive filtering method for the alpha plane. One of 'none',
265 \&'fast' or 'best', in increasing complexity and slowness order. Default is
266 \&'fast'. Internally, alpha filtering is performed using four possible
267 predictions (none, horizontal, vertical, gradient). The 'best' mode will try
268 each mode in turn and pick the one which gives the smaller size. The 'fast'
269 mode will just try to form an a priori guess without testing all modes.
270 .TP
271 .BI \-alpha_method " int
272 Specify the algorithm used for alpha compression: 0 or 1. Algorithm 0 denotes
273 no compression, 1 uses WebP lossless format for compression. The default is 1.
274 .TP
275 .B \-exact
276 Preserve RGB values in transparent area. The default is off, to help
277 compressibility.
278 .TP
279 .BI \-blend_alpha " int
280 This option blends the alpha channel (if present) with the source using the
281 background color specified in hexadecimal as 0xrrggbb. The alpha channel is
282 afterward reset to the opaque value 255.
283 .TP
284 .B \-noalpha
285 Using this option will discard the alpha channel.
286 .TP
287 .BI \-hint " string
288 Specify the hint about input image type. Possible values are:
289 \fBphoto\fP, \fBpicture\fP or \fBgraph\fP.
290 .TP
291 .BI \-metadata " string
292 A comma separated list of metadata to copy from the input to the output if
293 present.
294 Valid values: \fBall\fP, \fBnone\fP, \fBexif\fP, \fBicc\fP, \fBxmp\fP.
295 The default is \fBnone\fP.
296
297 Note: each input format may not support all combinations.
298 .TP
299 .B \-noasm
300 Disable all assembly optimizations.
301
302 .SH BUGS
303 Please report all bugs to the issue tracker:
304 https://bugs.chromium.org/p/webp
305 .br
306 Patches welcome! See this page to get started:
307 https://www.webmproject.org/code/contribute/submitting\-patches/
308
309 .SH EXAMPLES
310 cwebp \-q 50 -lossless picture.png \-o picture_lossless.webp
311 .br
312 cwebp \-q 70 picture_with_alpha.png \-o picture_with_alpha.webp
313 .br
314 cwebp \-sns 70 \-f 50 \-size 60000 picture.png \-o picture.webp
315 .br
316 cwebp \-o picture.webp \-\- \-\-\-picture.png
317
318 .SH AUTHORS
319 \fBcwebp\fP is a part of libwebp and was written by the WebP team.
320 .br
321 The latest source tree is available at
322 https://chromium.googlesource.com/webm/libwebp
323 .PP
324 This manual page was written by Pascal Massimino <[email protected]>,
325 for the Debian project (and may be used by others).
326
327 .SH SEE ALSO
328 .BR dwebp (1),
329 .BR gif2webp (1)
330 .br
331 Please refer to https://developers.google.com/speed/webp/ for additional
332 information.