Commit Graph

131 Commits

Author SHA1 Message Date
Yannis Guyon
4649b3c422 vwebp: Add background color display option
Option -usebgcolor may be used to display ANIM background color (or white if no ANIM chunk), blended on top of checkerboard. By default this is disabled (old behavior) to easily see transparent areas. Spec says that "background color MAY be used", so it's an option.
Key b may be pressed to toggle ANIM background color display. There are visual artifacts (leftovers) when toggling during an animation. This is already the case for rescaling, toggling info etc. (fixing it implies storing viewport render or rendering whole animation from start till current frame).

BUG=webp:394

Change-Id: If9ab898b2eac77226f30f062d522f9861789ef8f
2018-07-20 12:54:30 +02:00
James Zern
5d8985de47 configure,*am,cosmetics: s/WANT_/BUILD_/
'BUILD_' is more common across the build files

Change-Id: Id302dba2e9e567c186a9da1da0fba44517e85d07
2018-06-02 10:41:49 -07:00
James Zern
5cf3e2afb5 man/Makefile.am: add img2webp.1
Change-Id: I83ed6e85d36b79e6a97b93221fadb7d35e2305c5
2018-06-01 19:25:53 -07:00
James Zern
dc39b16fe4 webpmux.1: correct grammar
argument -> arguments

Change-Id: I57132c942150f18dccc5ef84c4c09a6dcc054ffa
2018-04-23 16:06:54 -07:00
Pascal Massimino
64a57d0587 add -version option to anim_dump,anim_diff and img2webp
This is to harmonize the -h/-version options on all our examples.

+ added GetAnimatedImageVersions() method to anim_util.*

Change-Id: I2304a1c29e310682e97f236d3867274a192a7a09
2018-04-03 11:46:17 -07:00
skal
94a8377b3e extract the command-line parsing helpers to example_util
+ make img2webp tool use the text-file parsing option too.

Change-Id: I1976e651bbe8b4701abceba89e054b4fb3c35696
2018-02-08 08:11:31 +00:00
James Zern
cbde5728c8 gif2webp: add support for reading from stdin
output to stdout is already supported; this matches [cd]webp

BUG=webp:371

Change-Id: Ib1ce1661b16ea792943bca2980f779584e90cc86
2018-01-26 03:13:44 -08:00
Vincent Rabaud
45a8b5eb59 Fix lint error with man page.
LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 \
     man --warnings -E UTF-8 -l -Tutf8 -Z img2webp.1 >/dev/null
would trigger it.

BUG=webp:370

Change-Id: I9543112bc58ac424af86bb65f7d894707a5646c7
2018-01-23 21:18:30 +01:00
Pascal Massimino
a7f93fe32d webpmux: allow reading argument from a file
if a single text file name is supplied as argument
(e.g.: 'webpmux my_long_list_of_frames.txt'), the command
line arguments are actually parsed from this file.
Tokenizer will remove space, tabs, LF, CR, returns, etc.

+ changed ImgIoUtilReadFile() to return a null-terminated
data, for convenience.

+ misc clean-up in the code

BUG=webp:355

Change-Id: I76796305641d660933de5881763d723006712fa9
---
2017-12-01 01:42:22 -08:00
James Zern
b69f18a73a gif2webp.1: fix -loop_compatibility layout
Change-Id: Ia29b7a9e3b72605d2bb8c13ad3e37b88094444f5
2017-11-29 22:59:30 -08:00
James Zern
126be10950 webpinfo: add -version option
Change-Id: I5861d5ccd2119dd6749dc70b65fd145b5a732f98
2017-11-24 14:21:05 -08:00
Pascal Massimino
b4e046778d gif2webp: introduce -loop_compatibility option
This patch fixes the compatibility for loop-count handling.
This aims at addressing the change in Chrome handling of loop-count
prior to M63.

Before M63: loop-count interpretation was aligned to GIF's behaviour in
Chrome, but incompatible with WebP's spec. In particular, you couldn't
loop exactly once.

Post-M63: loop-count in WebP is really the total number of loops. Gif2webp
will convert correctly from a GIF source by adjusting the loop count.

Note: The Chrome version can be retrieved from the User-Agent
string (chrome://version).
An M63 version will contain the pattern:
   Chrome/63.x.xxxx.xx
for instance.

Change-Id: Ie6dc13227e6498f4d7af2f09247913648997648a
2017-09-20 07:37:49 +00:00
Vincent Rabaud
f0569adb93 Fix man pages for multi-threading.
BUG=webp:336

Change-Id: I70d3dfb8a532c1f2b80bd08cc62e833962cb4b34
2017-06-15 08:49:04 +00:00
hui su
d63e6f4b23 Add a man page for webpinfo
BUG=webp:330

Change-Id: I7b02274401c935affa173a49a883a39272b6dcc3
2017-05-09 16:14:44 -07:00
Jehan
32ed856f60 Fix "all|no frames are keyframes" settings.
Documentation says: "if kmin == 0, then key-frame insertion is disabled;
and if kmax == 0, then all frames will be key-frames."
Reading this, you'd expect that if kmax == 0, then with any kmin <= 0
all frames will be key-frames. But actually the kmin <= 0 test is caught
first and you get the opposite (no keyframes but the first). You'd have
instead to set kmax == 0 and any value kmin > 0, which is absolutely
counter-intuitive (reversing order).
Moreover kmax == 1 has no valid kmin (kmin == 1 conflicts with the
`kmax > kmin` rule and kmin == 0 conflicts with `kmin >= kmax / 2 + 1`).
So it should be considered an exception too.

Instead I propose this new logic:
- kmax == 1 means that all frames are keyframes (you are explicitly
  requesting a keyframe every 1 frame at most, i.e. all frames).
- kmax == 0 means no keyframes (you ask for a keyframe every 0 frames,
  i.e. never).
This is more "logical" language-wise, and also does not involve any
conflicts about what if both kmax and kmin are 0, since now a single
property value is meaningful for the 2 exceptional cases.

Change-Id: Ia90fb963bc26904ff078d2e4ef9f74b22b13a0fd
(cherry picked from commit 2dc0bdcaee)
2017-01-26 22:31:16 -08:00
James Zern
3363eb6d68 man/img2webp.1: fix formatting warning
the default is format is roman, fixes:
`R' is a string (producing the registered sign), not a macro.

Change-Id: If2bce714eff1237cd1702ae1143323249d85b93b
2017-01-23 19:36:14 -08:00
Pascal Massimino
4689ce1635 cwebp: add a -sharp_yuv option for 'sharp' RGB->YUV conversion
Change-Id: I6edd5b44d693da50f702fa8218f14872874d91ba
2017-01-20 16:54:54 +01:00
Pascal Massimino
03f40955a3 img2webp: convert a sequence of images to an animated webp
Usage:

  img2webp [file-level options] [image files...] [per-frame options...]

File-level options (only used at the start of compression):
 -min_size ............ minimize size
 -loop <int> .......... loop count (default: 0, = infinite loop)
 -kmax <int> .......... maximum number of frame between key-frames
                        (0=only keyframes)
 -kmin <int> .......... minimum number of frame between key-frames
                        (0=disable key-frames altogether)
 -mixed ............... use mixed lossy/lossless automatic mode
 -v ................... verbose mode
 -h ................... this help

Per-frame options (only used for subsequent images input):
 -d <int> ............. frame duration in ms (default: 100)
 -lossless  ........... use lossless mode (default)
 -lossy ... ........... use lossy mode
 -q <float> ........... quality
 -m <int> ............. method to use

example: img2webp -loop 2 in0.png -lossy in1.jpg
                  -d 80 in2.tiff -o out.webp

Change-Id: I23771b90eaf0660f420d7ffd304e704155386286
2016-12-02 11:44:17 +01:00
Pascal Massimino
c85adb33d2 vwebp: make 'd' key toggle the debugging of fragments
it actually disables the disposal / blending method
and just displays the raw delta values.
Useful for debugging.
TODO: Outline the refreshed area with a drawn rectangle?

Change-Id: I6f8cddd0aad8b953cff78a693ae7e8c31def010c
2016-11-28 19:47:23 +00:00
Pascal Massimino
c0699515af webpmux -duration: set default 'end' value equal to 'start'
The options are now:
  -duration d     -> set the whole animation to duration 'd'
  -duration d,s   -> set only frame 's' to duration 'd'
  -duration d,s,e -> set only interval [s,d] to duration 'd'

+ style fix

Change-Id: I72e95282d520146f76696666f44280ad9506affa
2016-11-11 17:57:56 +00:00
Pascal Massimino
3f182d36f4 add a "-duration duration,start,end" option to webpmux
this will force a constant duration for an interval of frames
in an animation.
Notes:
 a) '-duration [...]' can be repeated as many times as needed.
 b) intervals are taken into account in option order. If they overlap, values will be overwritten.
 c) 'start' and 'end' can be omitted, but not the duration value.
 d) 'end' can be equal to '0', in which case it means 'last frame'
 e) single-image files are untouched (ie. not turned into an animation file).

Some example usage:
    webpmux -duration 150 in.webp -o out.webp
    webpmux -duration 33,10,0 in.webp -o out.webp
    webpmux -duration 200,2 -duration 150,0,50 in.webp -o out.webp

Change-Id: I9b595dafa77f9221bacd080be7858b1457f54636
2016-11-09 15:44:09 +01:00
James Zern
5b46f7fc80 cwebp.1: improve some grammar
Change-Id: Id849d7e0d7573f5b8d3b2e807d95e9c628f03b1e
2016-09-02 00:08:14 -07:00
Hui Su
74f6f9e793 Add descriptions of default configuration in help info.
Change-Id: I43188fab5f57bd45aa3e564df52e36cc37b1bb2f
2016-08-16 14:32:46 -07:00
Pascal Massimino
447adbce1e 'our bug tracker' -> 'the bug tracker'
(less exclusive wording)
(also a good opportunity to update the date)

Change-Id: Ife221f3f8ac3c38db93ec91954123edc3d8a4a6b
2016-06-23 16:06:12 -07:00
Pascal Massimino
4ed650a13d force "-pass 6" if -psnr or -size is used but -pass isn't.
This is to prevent users shooting in the foot using -psnr or
-size alone and not getting the expected result.

Change-Id: I67a3289e4ec0a2a813c98807f2ec5e600f52dc63
2016-02-13 10:22:32 +01:00
Pascal Massimino
d6dad5d05f man cwebp: add precision about exactness of the 'lossless' mode
Since now, -exact is no longer the default.

Change-Id: I4f6ee835738decd01b0be03caabc1479750548a8
2015-12-14 21:02:56 +00:00
James Zern
b5e30dac38 man/*, AUTHORS: clarify origin of the tool
mention libwebp in the AUTHORS section quote
+ add a direct link to the libwebp repo

Change-Id: I700614aa41f229910c82204f319355152b6b4f29
2015-12-11 18:48:38 -08:00
Lode Vandevenne
1f9be97c22 Make discarding invisible RGB values (cleanup alpha) the default.
Rename the flag to exact instead of the opposite cleanup_alpha. Add the flag to
WebPConfig. Do the cleanup in the webp encoder library rather than the cwebp
binary, this will be needed for the next stage: smarter alpha cleanup for
better compression which cannot be done as a preprocessing due to depending on
predictor choices in the encoder.

Change-Id: I2fbf57f918a35f2da6186ef0b5d85e5fd0020eef
2015-11-21 12:32:32 -08:00
James Zern
024324273e man/cwebp.1, cosmetics: escape '-'s
+ consistently make references to switches bold
+ add the default for -pass

Change-Id: I84abd9c0c878f8804c0f5dec806ca654e00b6661
2015-11-03 18:02:02 -08:00
James Zern
96f5b4237d man/cwebp: group lossy-only options
+ reorder / regroup other options based on basic vs. advanced + logging

Change-Id: I1cedef08e29f516952671f9e64771ee108e80867
2015-11-02 23:14:01 -08:00
James Zern
4b9186b2eb update issue tracker url
code.google.com -> bugs.chromium.org

Change-Id: I0dc99a85c29657415401160df3c7dd0423f96457
2015-10-19 20:06:50 -07:00
skal
41a5d99d55 add a -quiet option to 'dwebp'
(useful for tests)

Change-Id: Ia07f407bc1e819a1d3cab64a02317d058733261b
2015-08-17 20:07:46 -07:00
James Zern
1e595fe1e8 dwebp: add -resize as a synonym for -scale
-resize is used in cwebp for the same purpose

Change-Id: I2756f3d23c4799fc9a10c4fe8c4c17057beebca9
2015-08-13 22:46:02 -07:00
Vikas Arora
4c82284d2e Updated the near-lossless level mapping.
Updated the near-lossless level mapping and make it correlated to lossy
quality i.e 100 => minimum loss (in-fact no-loss) and the visual-quality loss
increases with decrease in near-lossless level (quality) till value 0.

The new mapping implies following (PSNR) loss-metric:
-near_lossless 100: No-loss (bit-stream same as -lossless).
-near_lossless  80: Very very high PSNR (around 54dB).
-near_lossless  60: Very high PSNR (around 48dB).
-near_lossless  40: High PSNR (around 42dB).
-near_lossless  20: Moderate PSNR (around 36dB).
-near_lossless   0: Low PSNR (around 30dB).

Change-Id: I930de4b18950faf2868c97d42e9e49ba0b642960
2015-02-05 11:17:14 -08:00
Urvang Joshi
b9df35f714 AnimEncode API: kmax=0 should imply all keyframes.
Earlier, it wasn't adding any keyframes at all.

Change-Id: If3824fc8e57548b8610a52e875fb9279f862fa57
2015-02-03 11:42:13 -08:00
Vikas Arora
98c8138663 Enable Near-lossless feature.
Enable the WebP near-lossless feature by pre-processing the image to smoothen
the pixels.

On a 1000 PNG image corpus, for which WebP lossless (default settings) gets
25% compression gains, following is the performance of near-lossless feature
at various '-near_lossless' levels:
-near_lossless 90: 30% (very very high PSNR 54-60dB)
-near_lossless 75: 38% (very high PSNR 48-54dB)
-near_lossless 50: 45% (high PSNR 42-48dB)
-near_lossless 25: 48% (moderate PSNR 36-42dB)
-near_lossless 10: 50% (PSNR 30-36dB)

WebP near-lossless is specifically useful for discrete-tone images like
line-art, icons etc.

Change-Id: I7d12a2c9362ccd076d09710ea05c85fa64664c38
2015-01-29 16:10:20 -08:00
Urvang Joshi
7489b0e72b gif2webp: Add '-min-size' option to get best compression.
This disables key-frame insertion and tries both dispose methods for
each frame.

Change-Id: Ib167747198fd1d98cb93321f76826e91228f24d8
2014-10-30 15:17:09 -07:00
Urvang Joshi
30f3b75b33 webpmux man page: Clarify some title, descriptions and examples
Based on the feedback here:
https://groups.google.com/a/webmproject.org/d/msg/webp-discuss/qY6rWJLqRTY/pF8oSj8DOGYJ

Change-Id: I9119ea8e211ffb269026010e3c590385bc6a9f17
2014-08-29 14:30:53 -07:00
skal
b5a36cc9ad add -near_lossless [0..100] experimental option
This compresses the uimage using lossless compression and controlable
decimating pre-process.
Code is under WEBP_EXPERIMENTAL_FEATURE while it's being experimented with.

Change-Id: I8b7f4cfcc3c6afc52a556102842bdbb045ed5ee8
2014-08-05 19:17:10 +02:00
James Zern
d3485d9607 cwebp.1: fix quality description placement
move it above '-z'

Change-Id: I776aaee31a3702923324c7c4101e6628499cb819
2014-07-30 11:08:27 -07:00
skal
bbe32df1e3 add alpha dithering for lossy
new options:
 dwebp -alpha_dither
 vwebp -noalphadither

When the source was marked as quantized, we use a threshold-averaging
filter to smooth the decoded alpha plane.
Note: this option forces the decoding of alpha data in one pass, and
might slow the decoding a bit.

The new field in WebPDecoderOptions struct is 'alpha_dithering_strength'
(0 by default, means: off). Max strength value is '100'.

Change-Id: I218e21af96360d4781587fede95f8ea4e2b7287a
2014-06-14 00:06:16 +02:00
James Zern
ddeb6ac802 cwebp: add webpdec
simple webp decoding, no metadata support

Change-Id: I2752fd1442c87513922878cbf72f001d45b631bc
2014-04-26 02:20:41 -07:00
James Zern
24ca3678f9 Merge "allow 'cwebp -o -' to emit output to stdout" 2014-03-12 14:01:15 -07:00
skal
e12f874eea allow 'cwebp -o -' to emit output to stdout
Change-Id: I423d25898e1ba317ccbf456bb28ce45663a3b3d2
2014-03-12 13:56:15 -07:00
skal
2bcad89b4c allow some more stdin/stout I/O
* allow reading from stdin for dwebp / vwebp
 * allow writing to stdout for gif2webp

by introducing a new function ExUtilReadFromStdin()

Example use: cat in.webp | dwebp -o - -- - > out.png

Note that the '-- -' option must appear *last*
(as per general fashion for '--' option parsing)

Change-Id: I8df0f3a246cc325925d6b6f668ba060f7dd81d68
2014-03-12 19:32:16 +01:00
skal
84ed4b3aa5 fix cwebp.1 typos after patch #69199
Change-Id: I046a54dbb4210319ddb156f49dd9d13d47b0d035
2014-03-11 23:46:50 +01:00
skal
65b99f1c92 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
2014-03-11 23:25:35 +01:00
skal
5da185522b add a decoding option to flip image vertically
New API options: WebPDecoderOptions.flip and 'dwebp -flip ...'

it uses negative stride trick.

Also changed the decoder code to support user-supplied
buffers with negative stride, independently of the
WebPDecoderOptions.flip value.

Change-Id: I4dc0d06f0c87e51a3f3428be4fee2d6b5ad76053
2014-01-16 15:48:43 +01:00
James Zern
00c3c4e114 Merge "add man/vwebp.1" 2014-01-10 17:47:57 -08:00
James Zern
2c6bb42806 add man/vwebp.1
Change-Id: I3257fdeb7d48af99946f751e3e2cd07660117255
2014-01-10 17:43:03 -08:00