Commit Graph

18 Commits

Author SHA1 Message Date
James Zern
da0d9c7d4e examples: exit w/failure w/no args
cwebp, gif2webp, img2webp, vwebp and webpinfo are modified in this
change to align with the other examples. When given no arguments, the
examples print their help output and exit with failure.

Bug: webp:42340557, webp:381372617
Change-Id: Ifed4eb79e98233f7aa780c42e489636d0cf4a035
2024-12-06 14:53:06 -08:00
James Zern
fcff86c71b {gif,img}2webp: sync -m help w/cwebp
These were both missing the mention of the default value (4).

Bug: webm:381109771
Change-Id: Ibb0d822310af443c5ff5219fc0334008de0a0c60
2024-11-26 13:08:29 -08:00
James Zern
57883c78ed img2webp: add -exact/-noexact per-frame options
Bug: b:363409354
Change-Id: I4e7282ed2df091dbef6d79743be1c8c868c0d44a
2024-09-03 18:58:13 -07:00
James Zern
1c8eba978b img2webp,cosmetics: add missing '.' spacers to help
Change-Id: I98e853a8caa091c182d41ea9d95499021c8deb3a
2024-09-03 18:27:45 -07:00
James Zern
a67ff735a2 normalize example exit status
Use EXIT_SUCCESS / EXIT_FAILURE in most cases as more granularity isn't
useful. For anim_diff, use 0 (success), 1 (image difference) and 2
(error) to align it with other diff utilities (diff, etc.).

Bug: webp:637
Change-Id: I52925de8622a5a4d2141883279d69a1d95ef9b12
2024-05-01 10:38:44 -07:00
James Zern
2fe27bb96d img2webp: normalize help output
this makes the output from img2webp and the ordering in doc/tools.md and
man/img2webp.1 consistent

Change-Id: Ic389aaa29c20128f2b87f231be383094602f125b
2023-03-17 15:37:55 -07:00
jzern@google.com
0825faa4c1 img2webp: add -sharp_yuv/-near_lossless
Both are global settings. Modifying them at the frame level is left as a
follow up based on need.

Bug: b/272739498
Change-Id: If15256c052f73fe3df56be5e0095e76d9870cc0f
2023-03-17 09:35:29 -07:00
James Zern
617cf03656 image_dec: add WebPGetEnabledInputFileFormats()
and use it to output the types supported in the examples

Change-Id: Ia6b8624a2146cf72c679129065a72f215644e1e9
2022-03-26 15:37:25 -07:00
Yannis Guyon
a80954a1d9 Reword img2webp synopsis command line
See https://bugs.chromium.org/p/webp/issues/detail?id=549

Change-Id: I75562d2ad021d8ec107eb4ced5b28e0abf373324
2022-01-05 10:15:28 +01:00
Pascal Massimino
906c1fcd61 make ImgIoUtilReadFile use WebPMalloc instead of malloc
This is a minor technical change in API in case a special allocator
was used in WebPMalloc.

Change-Id: Idb78a9150d006f158c1a9538525097749e42e7f7
2020-10-16 15:40:13 +02:00
James Zern
b6284d8247 img2webp: add help note about arguments from a file
this was added in:
94a8377b extract the command-line parsing helpers to example_util

and matches the help in webpmux

https://groups.google.com/a/webmproject.org/d/msg/webp-discuss/DJs-w_-Id6o/svFXs2CqBgAJ

BUG=webp:101

Change-Id: I2944d1fb1ed3030c356960be2a6c8de15a79311f
2018-10-26 06:16:56 +00:00
Yannis Guyon
9cf9841b5e libwebp: Unicode command tools on Windows
Define macros in examples/unicode.h to use Unicode argv
on Windows. Keep char everywhere on Unix since it handles
UTF-8 without any change.

Impact:
 - All fopen () and SHCreateStreamOnFile(),
 - All fprintf() printing file paths,
 - All strcmp() used with "-",
 - File path parsing,
 - Gif reading.

Concerned executables from examples/ and extras/:
  anim_diff, anim_dump, vwebp, vwebp_sdl,
  cwebp, dwebp, gif2webp, img2webp,
  webpmux, webpinfo, webp_quality, get_disto

When compiled on Windows with Unicode enabled, webpmux and
img2webp will not work when used with an argument file and
will print "Reading arguments from a file is a feature
unavailable with Unicode binaries."

BUG=webp:398

Change-Id: Ic55d222a3ce1a715f9c4cce57ecbe2705d5ce317
2018-10-17 13:19:40 +02: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
0d8e05880c img2webp: treat -loop as a no-op w/single images
or in cases where duplicates have been reduced to one

Change-Id: I145cd61b6792b021617f1234f0ba36e2a3128d84
2017-01-25 08:17:39 +00:00
James Zern
6451709e72 img2webp,get_disto: fix image decode w/WIC builds
similar to cwebp, attempt ReadPictureWithWIC() first

Change-Id: Ifb83aaa457be59c95b201bf8bd6b0877a6a253ed
2017-01-24 15:12:08 -08:00
Pascal Massimino
bded7848ea img2webp: fix default -lossless value and use pic.argb=1
Change-Id: I0e5350928c1e58e0901303ee979fb4587f25d6bc
2016-12-02 13:19:02 +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