Blame man/cwebp.1

Packit 9c6abc
.\"                                      Hey, EMACS: -*- nroff -*-
Packit 9c6abc
.TH CWEBP 1 "January 20, 2017"
Packit 9c6abc
.SH NAME
Packit 9c6abc
cwebp \- compress an image file to a WebP file
Packit 9c6abc
.SH SYNOPSIS
Packit 9c6abc
.B cwebp
Packit 9c6abc
.RI [ options ] " input_file \-o output_file.webp
Packit 9c6abc
.br
Packit 9c6abc
.SH DESCRIPTION
Packit 9c6abc
This manual page documents the
Packit 9c6abc
.B cwebp
Packit 9c6abc
command.
Packit 9c6abc
.PP
Packit 9c6abc
\fBcwebp\fP compresses an image using the WebP format.
Packit 9c6abc
Input format can be either PNG, JPEG, TIFF, WebP or raw Y'CbCr samples.
Packit 9c6abc
.SH OPTIONS
Packit 9c6abc
The basic options are:
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-o " string
Packit 9c6abc
Specify the name of the output WebP file. If omitted, \fBcwebp\fP will
Packit 9c6abc
perform compression but only report statistics.
Packit 9c6abc
Using "\-" as output name will direct output to 'stdout'.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-\- " string
Packit 9c6abc
Explicitly specify the input file. This option is useful if the input
Packit 9c6abc
file starts with a '\-' for instance. This option must appear \fBlast\fP.
Packit 9c6abc
Any other options afterward will be ignored.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-h, \-help
Packit 9c6abc
A short usage summary.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-H, \-longhelp
Packit 9c6abc
A summary of all the possible options.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-version
Packit 9c6abc
Print the version number (as major.minor.revision) and exit.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-lossless
Packit 9c6abc
Encode the image without any loss. For images with fully transparent area,
Packit 9c6abc
the invisible pixel values (R/G/B or Y/U/V) will be preserved only if the
Packit 9c6abc
\-exact option is used.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-near_lossless " int
Packit 9c6abc
Use near\-lossless image preprocessing. This option adjusts pixel values
Packit 9c6abc
to help compressibility, but has minimal impact on the visual quality.
Packit 9c6abc
It triggers lossless compression mode automatically.
Packit 9c6abc
Range is 0 (maximum preprocessing) to 100 (no preprocessing, the default).
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-q " float
Packit 9c6abc
Specify the compression factor for RGB channels between 0 and 100. The default
Packit 9c6abc
is 75.
Packit 9c6abc
.br
Packit 9c6abc
In case of lossy compression (default), a small factor produces a smaller file
Packit 9c6abc
with lower quality. Best quality is achieved by using a value of 100.
Packit 9c6abc
.br
Packit 9c6abc
In case of lossless compression (specified by the \fB\-lossless\fP option), a
Packit 9c6abc
small factor enables faster compression speed, but produces a larger file.
Packit 9c6abc
Maximum compression is achieved by using a value of 100.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-z " int
Packit 9c6abc
Switch on \fBlossless\fP compression mode with the specified level between 0
Packit 9c6abc
and 9, with level 0 being the fastest, 9 being the slowest. Fast mode
Packit 9c6abc
produces larger file size than slower ones. A good default is \fB\-z 6\fP.
Packit 9c6abc
This option is actually a shortcut for some predefined settings for quality
Packit 9c6abc
and method. If options \fB\-q\fP  or \fB\-m\fP are subsequently used, they will
Packit 9c6abc
invalidate the effect of this option.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-alpha_q " int
Packit 9c6abc
Specify the compression factor for alpha compression between 0 and 100.
Packit 9c6abc
Lossless compression of alpha is achieved using a value of 100, while the lower
Packit 9c6abc
values result in a lossy compression. The default is 100.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-preset " string
Packit 9c6abc
Specify a set of pre\-defined parameters to suit a particular type of
Packit 9c6abc
source material. Possible values are:  \fBdefault\fP, \fBphoto\fP,
Packit 9c6abc
\fBpicture\fP, \fBdrawing\fP, \fBicon\fP, \fBtext\fP. Since
Packit 9c6abc
\fB\-preset\fP overwrites the other parameters' values (except the
Packit 9c6abc
\fB\-q\fP one), this option should preferably appear first in the
Packit 9c6abc
order of the arguments.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-m " int
Packit 9c6abc
Specify the compression method to use. This parameter controls the
Packit 9c6abc
trade off between encoding speed and the compressed file size and quality.
Packit 9c6abc
Possible values range from 0 to 6. Default value is 4.
Packit 9c6abc
When higher values are used, the encoder will spend more time inspecting
Packit 9c6abc
additional encoding possibilities and decide on the quality gain.
Packit 9c6abc
Lower value can result in faster processing time at the expense of
Packit 9c6abc
larger file size and lower compression quality.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-resize " width height
Packit 9c6abc
Resize the source to a rectangle with size \fBwidth\fP x \fBheight\fP.
Packit 9c6abc
If either (but not both) of the \fBwidth\fP or \fBheight\fP parameters is 0,
Packit 9c6abc
the value will be calculated preserving the aspect\-ratio.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-crop " x_position y_position width height
Packit 9c6abc
Crop the source to a rectangle with top\-left corner at coordinates
Packit 9c6abc
(\fBx_position\fP, \fBy_position\fP) and size \fBwidth\fP x \fBheight\fP.
Packit 9c6abc
This cropping area must be fully contained within the source rectangle.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-mt
Packit 9c6abc
Use multi\-threading for encoding, if possible.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-low_memory
Packit 9c6abc
Reduce memory usage of lossy encoding by saving four times the compressed
Packit 9c6abc
size (typically). This will make the encoding slower and the output slightly
Packit 9c6abc
different in size and distortion. This flag is only effective for methods
Packit 9c6abc
3 and up, and is off by default. Note that leaving this flag off will have
Packit 9c6abc
some side effects on the bitstream: it forces certain bitstream features
Packit 9c6abc
like number of partitions (forced to 1). Note that a more detailed report
Packit 9c6abc
of bitstream size is printed by \fBcwebp\fP when using this option.
Packit 9c6abc
Packit 9c6abc
.SS LOSSY OPTIONS
Packit 9c6abc
These options are only effective when doing lossy encoding (the default, with
Packit 9c6abc
or without alpha).
Packit 9c6abc
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-size " int
Packit 9c6abc
Specify a target size (in bytes) to try and reach for the compressed output.
Packit 9c6abc
The compressor will make several passes of partial encoding in order to get as
Packit 9c6abc
close as possible to this target. If both \fB\-size\fP and \fB\-psnr\fP
Packit 9c6abc
are used, \fB\-size\fP value will prevail.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-psnr " float
Packit 9c6abc
Specify a target PSNR (in dB) to try and reach for the compressed output.
Packit 9c6abc
The compressor will make several passes of partial encoding in order to get as
Packit 9c6abc
close as possible to this target. If both \fB\-size\fP and \fB\-psnr\fP
Packit 9c6abc
are used, \fB\-size\fP value will prevail.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-pass " int
Packit 9c6abc
Set a maximum number of passes to use during the dichotomy used by
Packit 9c6abc
options \fB\-size\fP or \fB\-psnr\fP. Maximum value is 10, default is 1.
Packit 9c6abc
If options \fB\-size\fP or \fB\-psnr\fP were used, but \fB\-pass\fP wasn't
Packit 9c6abc
specified, a default value of '6' passes will be used.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-af
Packit 9c6abc
Turns auto\-filter on. This algorithm will spend additional time optimizing
Packit 9c6abc
the filtering strength to reach a well\-balanced quality.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-jpeg_like
Packit 9c6abc
Change the internal parameter mapping to better match the expected size
Packit 9c6abc
of JPEG compression. This flag will generally produce an output file of
Packit 9c6abc
similar size to its JPEG equivalent (for the same \fB\-q\fP setting), but
Packit 9c6abc
with less visual distortion.
Packit 9c6abc
Packit 9c6abc
.TP
Packit 9c6abc
Advanced options:
Packit 9c6abc
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-f " int
Packit 9c6abc
Specify the strength of the deblocking filter, between 0 (no filtering)
Packit 9c6abc
and 100 (maximum filtering). A value of 0 will turn off any filtering.
Packit 9c6abc
Higher value will increase the strength of the filtering process applied
Packit 9c6abc
after decoding the picture. The higher the value the smoother the picture will
Packit 9c6abc
appear. Typical values are usually in the range of 20 to 50.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-sharpness " int
Packit 9c6abc
Specify the sharpness of the filtering (if used).
Packit 9c6abc
Range is 0 (sharpest) to 7 (least sharp). Default is 0.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-strong
Packit 9c6abc
Use strong filtering (if filtering is being used thanks to the
Packit 9c6abc
\fB\-f\fP option). Strong filtering is on by default.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-nostrong
Packit 9c6abc
Disable strong filtering (if filtering is being used thanks to the
Packit 9c6abc
\fB\-f\fP option) and use simple filtering instead.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-sharp_yuv
Packit 9c6abc
Use more accurate and sharper RGB->YUV conversion if needed. Note that this
Packit 9c6abc
process is slower than the default 'fast' RGB->YUV conversion.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-sns " int
Packit 9c6abc
Specify the amplitude of the spatial noise shaping. Spatial noise shaping
Packit 9c6abc
(or \fBsns\fP for short) refers to a general collection of built\-in algorithms
Packit 9c6abc
used to decide which area of the picture should use relatively less bits,
Packit 9c6abc
and where else to better transfer these bits. The possible range goes from
Packit 9c6abc
0 (algorithm is off) to 100 (the maximal effect). The default value is 50.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-segments " int
Packit 9c6abc
Change the number of partitions to use during the segmentation of the
Packit 9c6abc
sns algorithm. Segments should be in range 1 to 4. Default value is 4.
Packit 9c6abc
This option has no effect for methods 3 and up, unless \fB\-low_memory\fP
Packit 9c6abc
is used.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-partition_limit " int
Packit 9c6abc
Degrade quality by limiting the number of bits used by some macroblocks.
Packit 9c6abc
Range is 0 (no degradation, the default) to 100 (full degradation).
Packit 9c6abc
Useful values are usually around 30\-70 for moderately large images.
Packit 9c6abc
In the VP8 format, the so\-called control partition has a limit of 512k and
Packit 9c6abc
is used to store the following information: whether the macroblock is skipped,
Packit 9c6abc
which segment it belongs to, whether it is coded as intra 4x4 or intra 16x16
Packit 9c6abc
mode, and finally the prediction modes to use for each of the sub\-blocks.
Packit 9c6abc
For a very large image, 512k only leaves room to few bits per 16x16 macroblock.
Packit 9c6abc
The absolute minimum is 4 bits per macroblock. Skip, segment, and mode
Packit 9c6abc
information can use up almost all these 4 bits (although the case is unlikely),
Packit 9c6abc
which is problematic for very large images. The partition_limit factor controls
Packit 9c6abc
how frequently the most bit\-costly mode (intra 4x4) will be used. This is
Packit 9c6abc
useful in case the 512k limit is reached and the following message is displayed:
Packit 9c6abc
\fIError code: 6 (PARTITION0_OVERFLOW: Partition #0 is too big to fit 512k)\fP.
Packit 9c6abc
If using \fB\-partition_limit\fP is not enough to meet the 512k constraint, one
Packit 9c6abc
should use less segments in order to save more header bits per macroblock.
Packit 9c6abc
See the \fB\-segments\fP option.
Packit 9c6abc
Packit 9c6abc
.SS LOGGING OPTIONS
Packit 9c6abc
These options control the level of output:
Packit 9c6abc
.TP
Packit 9c6abc
.B \-v
Packit 9c6abc
Print extra information (encoding time in particular).
Packit 9c6abc
.TP
Packit 9c6abc
.B \-print_psnr
Packit 9c6abc
Compute and report average PSNR (Peak\-Signal\-To\-Noise ratio).
Packit 9c6abc
.TP
Packit 9c6abc
.B \-print_ssim
Packit 9c6abc
Compute and report average SSIM (structural similarity
Packit 9c6abc
metric, see http://en.wikipedia.org/wiki/SSIM for additional details).
Packit 9c6abc
.TP
Packit 9c6abc
.B \-print_lsim
Packit 9c6abc
Compute and report local similarity metric (sum of lowest error amongst the
Packit 9c6abc
collocated pixel neighbors).
Packit 9c6abc
.TP
Packit 9c6abc
.B \-progress
Packit 9c6abc
Report encoding progress in percent.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-quiet
Packit 9c6abc
Do not print anything.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-short
Packit 9c6abc
Only print brief information (output file size and PSNR) for testing purposes.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-map " int
Packit 9c6abc
Output additional ASCII\-map of encoding information. Possible map values
Packit 9c6abc
range from 1 to 6. This is only meant to help debugging.
Packit 9c6abc
Packit 9c6abc
.SS ADDITIONAL OPTIONS
Packit 9c6abc
More advanced options are:
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-s " width height
Packit 9c6abc
Specify that the input file actually consists of raw Y'CbCr samples following
Packit 9c6abc
the ITU\-R BT.601 recommendation, in 4:2:0 linear format.
Packit 9c6abc
The luma plane has size \fBwidth\fP x \fBheight\fP.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-pre " int
Packit 9c6abc
Specify some preprocessing steps. Using a value of '2' will trigger
Packit 9c6abc
quality\-dependent pseudo\-random dithering during RGBA\->YUVA conversion
Packit 9c6abc
(lossy compression only).
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-alpha_filter " string
Packit 9c6abc
Specify the predictive filtering method for the alpha plane. One of 'none',
Packit 9c6abc
\&'fast' or 'best', in increasing complexity and slowness order. Default is
Packit 9c6abc
\&'fast'. Internally, alpha filtering is performed using four possible
Packit 9c6abc
predictions (none, horizontal, vertical, gradient). The 'best' mode will try
Packit 9c6abc
each mode in turn and pick the one which gives the smaller size. The 'fast'
Packit 9c6abc
mode will just try to form an a priori guess without testing all modes.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-alpha_method " int
Packit 9c6abc
Specify the algorithm used for alpha compression: 0 or 1. Algorithm 0 denotes
Packit 9c6abc
no compression, 1 uses WebP lossless format for compression. The default is 1.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-exact
Packit 9c6abc
Preserve RGB values in transparent area. The default is off, to help
Packit 9c6abc
compressibility.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-blend_alpha " int
Packit 9c6abc
This option blends the alpha channel (if present) with the source using the
Packit 9c6abc
background color specified in hexadecimal as 0xrrggbb. The alpha channel is
Packit 9c6abc
afterward reset to the opaque value 255.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-noalpha
Packit 9c6abc
Using this option will discard the alpha channel.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-hint " string
Packit 9c6abc
Specify the hint about input image type. Possible values are:
Packit 9c6abc
\fBphoto\fP, \fBpicture\fP or \fBgraph\fP.
Packit 9c6abc
.TP
Packit 9c6abc
.BI \-metadata " string
Packit 9c6abc
A comma separated list of metadata to copy from the input to the output if
Packit 9c6abc
present.
Packit 9c6abc
Valid values: \fBall\fP, \fBnone\fP, \fBexif\fP, \fBicc\fP, \fBxmp\fP.
Packit 9c6abc
The default is \fBnone\fP.
Packit 9c6abc
Packit 9c6abc
Note: each input format may not support all combinations.
Packit 9c6abc
.TP
Packit 9c6abc
.B \-noasm
Packit 9c6abc
Disable all assembly optimizations.
Packit 9c6abc
Packit 9c6abc
.SH BUGS
Packit 9c6abc
Please report all bugs to the issue tracker:
Packit 9c6abc
https://bugs.chromium.org/p/webp
Packit 9c6abc
.br
Packit 9c6abc
Patches welcome! See this page to get started:
Packit 9c6abc
http://www.webmproject.org/code/contribute/submitting\-patches/
Packit 9c6abc
Packit 9c6abc
.SH EXAMPLES
Packit 9c6abc
cwebp \-q 50 -lossless picture.png \-o picture_lossless.webp
Packit 9c6abc
.br
Packit 9c6abc
cwebp \-q 70 picture_with_alpha.png \-o picture_with_alpha.webp
Packit 9c6abc
.br
Packit 9c6abc
cwebp \-sns 70 \-f 50 \-size 60000 picture.png \-o picture.webp
Packit 9c6abc
.br
Packit 9c6abc
cwebp \-o picture.webp \-\- \-\-\-picture.png
Packit 9c6abc
Packit 9c6abc
.SH AUTHORS
Packit 9c6abc
\fBcwebp\fP is a part of libwebp and was written by the WebP team.
Packit 9c6abc
.br
Packit 9c6abc
The latest source tree is available at
Packit 9c6abc
https://chromium.googlesource.com/webm/libwebp
Packit 9c6abc
.PP
Packit 9c6abc
This manual page was written by Pascal Massimino <pascal.massimino@gmail.com>,
Packit 9c6abc
for the Debian project (and may be used by others).
Packit 9c6abc
Packit 9c6abc
.SH SEE ALSO
Packit 9c6abc
.BR dwebp (1),
Packit 9c6abc
.BR gif2webp (1)
Packit 9c6abc
.br
Packit 9c6abc
Please refer to http://developers.google.com/speed/webp/ for additional
Packit 9c6abc
information.