1CWEBP(1)                    General Commands Manual                   CWEBP(1)
2
3
4

NAME

6       cwebp - compress an image file to a WebP file
7

SYNOPSIS

9       cwebp [options] input_file -o output_file.webp
10

DESCRIPTION

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, WebP or raw Y'CbCr samples.
16

OPTIONS

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.  Using "-" as
23              output name will direct output to 'stdout'.
24
25       -- string
26              Explicitly specify the input file. This option is useful if  the
27              input  file  starts  with  a  '-' for instance. This option must
28              appear last.  Any other options afterward will be ignored.
29
30       -h, -help
31              A short usage summary.
32
33       -H, -longhelp
34              A summary of all the possible options.
35
36       -version
37              Print the version number (as major.minor.revision) and exit.
38
39       -lossless
40              Encode the image without any loss. For images with fully  trans‐
41              parent area, the invisible pixel values (R/G/B or Y/U/V) will be
42              preserved only if the -exact option is used.
43
44       -near_lossless int
45              Specify the level of  near-lossless  image  preprocessing.  This
46              option  adjusts  pixel  values  to help compressibility, but has
47              minimal impact on the visual quality. It triggers lossless  com‐
48              pression mode automatically. The range is 0 (maximum preprocess‐
49              ing) to 100 (no preprocessing, the default). The  typical  value
50              is  around  60.  Note  that lossy with -q 100 can at times yield
51              better results.
52
53       -q float
54              Specify the compression factor for RGB channels  between  0  and
55              100. The default is 75.
56              In  case of lossy compression (default), a small factor produces
57              a smaller file with lower quality. Best quality is  achieved  by
58              using a value of 100.
59              In  case  of  lossless  compression  (specified by the -lossless
60              option), a small factor enables faster  compression  speed,  but
61              produces  a  larger  file.   Maximum  compression is achieved by
62              using a value of 100.
63
64       -z int Switch on lossless compression mode  with  the  specified  level
65              between  0  and  9,  with level 0 being the fastest, 9 being the
66              slowest. Fast mode produces larger file size than slower ones. A
67              good  default  is  -z 6.  This option is actually a shortcut for
68              some predefined settings for quality and method. If  options  -q
69              or  -m are subsequently used, they will invalidate the effect of
70              this option.
71
72       -alpha_q int
73              Specify the compression factor for alpha compression  between  0
74              and  100.   Lossless  compression  of  alpha is achieved using a
75              value of 100, while the lower values result in a lossy  compres‐
76              sion. The default is 100.
77
78       -preset string
79              Specify  a  set  of  pre-defined parameters to suit a particular
80              type of source material. Possible values are:   default,  photo,
81              picture, drawing, icon, text. Since -preset overwrites the other
82              parameters' values (except  the  -q  one),  this  option  should
83              preferably appear first in the order of the arguments.
84
85       -m int Specify  the  compression method to use. This parameter controls
86              the trade off between encoding speed  and  the  compressed  file
87              size  and  quality.   Possible values range from 0 to 6. Default
88              value is 4.  When higher values are used, the encoder will spend
89              more  time  inspecting  additional  encoding  possibilities  and
90              decide on the quality gain.  Lower value can  result  in  faster
91              processing  time  at  the  expense of larger file size and lower
92              compression quality.
93
94       -resize width height
95              Resize the source to a rectangle with size width x  height.   If
96              either  (but  not  both) of the width or height parameters is 0,
97              the value will be calculated preserving the aspect-ratio.
98
99       -crop x_position y_position width height
100              Crop the source to a rectangle with top-left corner  at  coordi‐
101              nates  (x_position,  y_position)  and size width x height.  This
102              cropping area must be fully contained within the source  rectan‐
103              gle.
104
105       -mt    Use multi-threading for encoding, if possible.
106
107       -low_memory
108              Reduce  memory  usage of lossy encoding by saving four times the
109              compressed size (typically). This will make the encoding  slower
110              and  the  output slightly different in size and distortion. This
111              flag is only effective for methods 3  and  up,  and  is  off  by
112              default.  Note  that  leaving  this flag off will have some side
113              effects on the bitstream: it forces certain  bitstream  features
114              like  number  of  partitions  (forced  to  1).  Note that a more
115              detailed report of bitstream size is printed by cwebp when using
116              this option.
117
118
119   LOSSY OPTIONS
120       These  options  are  only  effective  when  doing  lossy  encoding (the
121       default, with or without alpha).
122
123
124       -size int
125              Specify a target size (in bytes) to try and reach for  the  com‐
126              pressed output.  The compressor will make several passes of par‐
127              tial encoding in order to get as close as possible to this  tar‐
128              get. If both -size and -psnr are used, -size value will prevail.
129
130       -psnr float
131              Specify  a  target  PSNR  (in  dB) to try and reach for the com‐
132              pressed output.  The compressor will make several passes of par‐
133              tial  encoding in order to get as close as possible to this tar‐
134              get. If both -size and -psnr are used, -size value will prevail.
135
136       -pass int
137              Set a maximum number of passes to use during the dichotomy  used
138              by  options  -size  or -psnr. Maximum value is 10, default is 1.
139              If options -size or -psnr were used, but -pass wasn't specified,
140              a default value of '6' passes will be used.
141
142       -af    Turns  auto-filter on. This algorithm will spend additional time
143              optimizing the filtering strength to reach a well-balanced qual‐
144              ity.
145
146       -jpeg_like
147              Change  the  internal  parameter  mapping  to  better  match the
148              expected size of JPEG compression. This flag will generally pro‐
149              duce  an output file of similar size to its JPEG equivalent (for
150              the same -q setting), but with less visual distortion.
151
152
153       Advanced options:
154
155
156       -f int Specify the strength of the deblocking  filter,  between  0  (no
157              filtering)  and  100 (maximum filtering). A value of 0 will turn
158              off any filtering.  Higher value will increase the  strength  of
159              the  filtering  process  applied after decoding the picture. The
160              higher the value the smoother the picture will  appear.  Typical
161              values are usually in the range of 20 to 50.
162
163       -sharpness int
164              Specify  the  sharpness  of the filtering (if used).  Range is 0
165              (sharpest) to 7 (least sharp). Default is 0.
166
167       -strong
168              Use strong filtering (if filtering is being used thanks  to  the
169              -f option). Strong filtering is on by default.
170
171       -nostrong
172              Disable  strong  filtering (if filtering is being used thanks to
173              the -f option) and use simple filtering instead.
174
175       -sharp_yuv
176              Use more accurate and sharper  RGB->YUV  conversion  if  needed.
177              Note  that  this  process  is  slower  than  the  default 'fast'
178              RGB->YUV conversion.
179
180       -sns int
181              Specify the amplitude of  the  spatial  noise  shaping.  Spatial
182              noise  shaping (or sns for short) refers to a general collection
183              of built-in algorithms used to decide which area of the  picture
184              should use relatively less bits, and where else to better trans‐
185              fer these bits. The possible range goes  from  0  (algorithm  is
186              off) to 100 (the maximal effect). The default value is 50.
187
188       -segments int
189              Change  the  number of partitions to use during the segmentation
190              of the sns algorithm. Segments  should  be  in  range  1  to  4.
191              Default value is 4.  This option has no effect for methods 3 and
192              up, unless -low_memory is used.
193
194       -partition_limit int
195              Degrade quality by limiting the number of bits used by some mac‐
196              roblocks.  Range is 0 (no degradation, the default) to 100 (full
197              degradation).  Useful values are usually around 30-70 for moder‐
198              ately  large  images.   In the VP8 format, the so-called control
199              partition has a limit of 512k and is used to store the following
200              information: whether the macroblock is skipped, which segment it
201              belongs to, whether it is coded as  intra  4x4  or  intra  16x16
202              mode,  and  finally  the prediction modes to use for each of the
203              sub-blocks.  For a very large image, 512k only  leaves  room  to
204              few  bits  per 16x16 macroblock.  The absolute minimum is 4 bits
205              per macroblock. Skip, segment, and mode information can  use  up
206              almost  all  these 4 bits (although the case is unlikely), which
207              is problematic for very large images. The partition_limit factor
208              controls  how  frequently  the  most bit-costly mode (intra 4x4)
209              will be used. This is useful in case the 512k limit  is  reached
210              and  the  following  message is displayed: Error code: 6 (PARTI‐
211              TION0_OVERFLOW: Partition #0 is too big to fit 512k).  If  using
212              -partition_limit  is not enough to meet the 512k constraint, one
213              should use less segments in order to save more header  bits  per
214              macroblock.  See the -segments option.
215
216
217   LOGGING OPTIONS
218       These options control the level of output:
219
220       -v     Print extra information (encoding time in particular).
221
222       -print_psnr
223              Compute and report average PSNR (Peak-Signal-To-Noise ratio).
224
225       -print_ssim
226              Compute  and  report average SSIM (structural similarity metric,
227              see http://en.wikipedia.org/wiki/SSIM for additional details).
228
229       -print_lsim
230              Compute and report local similarity metric (sum of lowest  error
231              amongst the collocated pixel neighbors).
232
233       -progress
234              Report encoding progress in percent.
235
236       -quiet Do not print anything.
237
238       -short Only  print  brief  information  (output file size and PSNR) for
239              testing purposes.
240
241       -map int
242              Output additional ASCII-map of  encoding  information.  Possible
243              map  values range from 1 to 6. This is only meant to help debug‐
244              ging.
245
246
247   ADDITIONAL OPTIONS
248       More advanced options are:
249
250       -s width height
251              Specify that the input file actually consists of raw Y'CbCr sam‐
252              ples  following the ITU-R BT.601 recommendation, in 4:2:0 linear
253              format.  The luma plane has size width x height.
254
255       -pre int
256              Specify some preprocessing steps. Using  a  value  of  '2'  will
257              trigger   quality-dependent   pseudo-random   dithering   during
258              RGBA->YUVA conversion (lossy compression only).
259
260       -alpha_filter string
261              Specify the predictive filtering method for the alpha plane. One
262              of  'none', 'fast' or 'best', in increasing complexity and slow‐
263              ness order. Default is 'fast'. Internally,  alpha  filtering  is
264              performed  using  four  possible  predictions (none, horizontal,
265              vertical, gradient). The 'best' mode will try each mode in  turn
266              and  pick  the one which gives the smaller size. The 'fast' mode
267              will just try to form an a  priori  guess  without  testing  all
268              modes.
269
270       -alpha_method int
271              Specify  the algorithm used for alpha compression: 0 or 1. Algo‐
272              rithm 0 denotes no compression, 1 uses WebP lossless format  for
273              compression. The default is 1.
274
275       -exact Preserve  RGB values in transparent area. The default is off, to
276              help compressibility.
277
278       -blend_alpha int
279              This option blends the  alpha  channel  (if  present)  with  the
280              source  using  the  background color specified in hexadecimal as
281              0xrrggbb. The alpha channel is afterward  reset  to  the  opaque
282              value 255.
283
284       -noalpha
285              Using this option will discard the alpha channel.
286
287       -hint string
288              Specify  the  hint  about input image type. Possible values are:
289              photo, picture or graph.
290
291       -metadata string
292              A comma separated list of metadata to copy from the input to the
293              output  if  present.   Valid  values: all, none, exif, icc, xmp.
294              The default is none.
295
296              Note: each input format may not support all combinations.
297
298       -noasm Disable all assembly optimizations.
299
300

BUGS

302       Please    report     all     bugs     to     the     issue     tracker:
303       https://bugs.chromium.org/p/webp
304       Patches  welcome!  See  this  page  to get started: http://www.webmpro
305       ject.org/code/contribute/submitting-patches/
306
307

EXAMPLES

309       cwebp -q 50 -lossless picture.png -o picture_lossless.webp
310       cwebp -q 70 picture_with_alpha.png -o picture_with_alpha.webp
311       cwebp -sns 70 -f 50 -size 60000 picture.png -o picture.webp
312       cwebp -o picture.webp -- ---picture.png
313
314

AUTHORS

316       cwebp is a part of libwebp and was written by the WebP team.
317       The  latest  source  tree  is  available  at   https://chromium.google
318       source.com/webm/libwebp
319
320       This   manual   page  was  written  by  Pascal  Massimino  <pascal.mas‐
321       simino@gmail.com>, for the Debian project (and may be used by others).
322
323

SEE ALSO

325       dwebp(1), gif2webp(1)
326       Please refer to http://developers.google.com/speed/webp/ for additional
327       information.
328
329
330
331                               January 11, 2019                       CWEBP(1)
Impressum