add a -z option to cwebp, and WebPConfigLosslessPreset() function

These are presets for lossless coding, similar to zlib.
The shortcut for lossless coding is now, e.g.:
   cwebp -z 5 in.png -o out_lossless.webp

There are 10 possible values for -z parameter:
   0 (fastest, lowest compression)
to 9 (slowest, best compression)

A reasonable tradeoff is -z 6, e.g.
-z 9 can be quite slow, so use with care.

This -z option is just a shortcut for some pre-defined
'-lossless -m xx -q yy' combinations.

Change-Id: I6ae716456456aea065469c916c2d5ca4d6c6cf04
This commit is contained in:
skal
2014-03-11 23:25:35 +01:00
parent 30176619c6
commit 65b99f1c92
4 changed files with 54 additions and 2 deletions

View File

@ -1,5 +1,5 @@
.\" Hey, EMACS: -*- nroff -*-
.TH CWEBP 1 "December 12, 2013"
.TH CWEBP 1 "March 11, 2014"
.SH NAME
cwebp \- compress an image file to a WebP file
.SH SYNOPSIS
@ -32,6 +32,14 @@ Print the version number (as major.minor.revision) and exit.
.BI \-q " float
Specify the compression factor for RGB channels between 0 and 100. The default
is 75.
.TP
.BI \-z " int
Switch on \fBlossless\fP compression mode with the specified level between 0
and 9, with level 0 being the fastest, 9 being the slowest. Fast mode
produce larger file size than fast ones. A good default is \-z 6.
This option is actually a shortcut for some predefined setting for quality
and method. If options \-q or \-m are subsequently used, they will invalidate
the effect of this \-z option.
.br
In case of lossy compression (default), a small factor produces a smaller file
with lower quality. Best quality is achieved by using a value of 100.