1*b2055c35SXin Li# WebP tools 2*b2055c35SXin Li 3*b2055c35SXin Li## Encoding tool 4*b2055c35SXin Li 5*b2055c35SXin LiThe examples/ directory contains tools for encoding (cwebp) and decoding (dwebp) 6*b2055c35SXin Liimages. 7*b2055c35SXin Li 8*b2055c35SXin LiThe easiest use should look like: 9*b2055c35SXin Li 10*b2055c35SXin Li```shell 11*b2055c35SXin Licwebp input.png -q 80 -o output.webp 12*b2055c35SXin Li``` 13*b2055c35SXin Li 14*b2055c35SXin Liwhich will convert the input file to a WebP file using a quality factor of 80 on 15*b2055c35SXin Lia 0->100 scale (0 being the lowest quality, 100 being the best. Default value is 16*b2055c35SXin Li75). 17*b2055c35SXin Li 18*b2055c35SXin LiYou might want to try the `-lossless` flag too, which will compress the source 19*b2055c35SXin Li(in RGBA format) without any loss. The `-q` quality parameter will in this case 20*b2055c35SXin Licontrol the amount of processing time spent trying to make the output file as 21*b2055c35SXin Lismall as possible. 22*b2055c35SXin Li 23*b2055c35SXin LiA longer list of options is available using the `-longhelp` command line flag: 24*b2055c35SXin Li 25*b2055c35SXin Li```shell 26*b2055c35SXin Li> cwebp -longhelp 27*b2055c35SXin LiUsage: 28*b2055c35SXin Li cwebp [-preset <...>] [options] in_file [-o out_file] 29*b2055c35SXin Li``` 30*b2055c35SXin Li 31*b2055c35SXin LiIf input size (-s) for an image is not specified, it is assumed to be a PNG, 32*b2055c35SXin LiJPEG, TIFF or WebP file. Note: Animated PNG and WebP files are not supported. 33*b2055c35SXin Li 34*b2055c35SXin LiOptions: 35*b2055c35SXin Li 36*b2055c35SXin Li``` 37*b2055c35SXin Li-h / -help ............. short help 38*b2055c35SXin Li-H / -longhelp ......... long help 39*b2055c35SXin Li-q <float> ............. quality factor (0:small..100:big), default=75 40*b2055c35SXin Li-alpha_q <int> ......... transparency-compression quality (0..100), 41*b2055c35SXin Li default=100 42*b2055c35SXin Li-preset <string> ....... preset setting, one of: 43*b2055c35SXin Li default, photo, picture, 44*b2055c35SXin Li drawing, icon, text 45*b2055c35SXin Li -preset must come first, as it overwrites other parameters 46*b2055c35SXin Li-z <int> ............... activates lossless preset with given 47*b2055c35SXin Li level in [0:fast, ..., 9:slowest] 48*b2055c35SXin Li 49*b2055c35SXin Li-m <int> ............... compression method (0=fast, 6=slowest), default=4 50*b2055c35SXin Li-segments <int> ........ number of segments to use (1..4), default=4 51*b2055c35SXin Li-size <int> ............ target size (in bytes) 52*b2055c35SXin Li-psnr <float> .......... target PSNR (in dB. typically: 42) 53*b2055c35SXin Li 54*b2055c35SXin Li-s <int> <int> ......... input size (width x height) for YUV 55*b2055c35SXin Li-sns <int> ............. spatial noise shaping (0:off, 100:max), default=50 56*b2055c35SXin Li-f <int> ............... filter strength (0=off..100), default=60 57*b2055c35SXin Li-sharpness <int> ....... filter sharpness (0:most .. 7:least sharp), default=0 58*b2055c35SXin Li-strong ................ use strong filter instead of simple (default) 59*b2055c35SXin Li-nostrong .............. use simple filter instead of strong 60*b2055c35SXin Li-sharp_yuv ............. use sharper (and slower) RGB->YUV conversion 61*b2055c35SXin Li-partition_limit <int> . limit quality to fit the 512k limit on 62*b2055c35SXin Li the first partition (0=no degradation ... 100=full) 63*b2055c35SXin Li-pass <int> ............ analysis pass number (1..10) 64*b2055c35SXin Li-qrange <min> <max> .... specifies the permissible quality range 65*b2055c35SXin Li (default: 0 100) 66*b2055c35SXin Li-crop <x> <y> <w> <h> .. crop picture with the given rectangle 67*b2055c35SXin Li-resize <w> <h> ........ resize picture (*after* any cropping) 68*b2055c35SXin Li-mt .................... use multi-threading if available 69*b2055c35SXin Li-low_memory ............ reduce memory usage (slower encoding) 70*b2055c35SXin Li-map <int> ............. print map of extra info 71*b2055c35SXin Li-print_psnr ............ prints averaged PSNR distortion 72*b2055c35SXin Li-print_ssim ............ prints averaged SSIM distortion 73*b2055c35SXin Li-print_lsim ............ prints local-similarity distortion 74*b2055c35SXin Li-d <file.pgm> .......... dump the compressed output (PGM file) 75*b2055c35SXin Li-alpha_method <int> .... transparency-compression method (0..1), default=1 76*b2055c35SXin Li-alpha_filter <string> . predictive filtering for alpha plane, 77*b2055c35SXin Li one of: none, fast (default) or best 78*b2055c35SXin Li-exact ................. preserve RGB values in transparent area, default=off 79*b2055c35SXin Li-blend_alpha <hex> ..... blend colors against background color 80*b2055c35SXin Li expressed as RGB values written in 81*b2055c35SXin Li hexadecimal, e.g. 0xc0e0d0 for red=0xc0 82*b2055c35SXin Li green=0xe0 and blue=0xd0 83*b2055c35SXin Li-noalpha ............... discard any transparency information 84*b2055c35SXin Li-lossless .............. encode image losslessly, default=off 85*b2055c35SXin Li-near_lossless <int> ... use near-lossless image preprocessing 86*b2055c35SXin Li (0..100=off), default=100 87*b2055c35SXin Li-hint <string> ......... specify image characteristics hint, 88*b2055c35SXin Li one of: photo, picture or graph 89*b2055c35SXin Li 90*b2055c35SXin Li-metadata <string> ..... comma separated list of metadata to 91*b2055c35SXin Li copy from the input to the output if present. 92*b2055c35SXin Li Valid values: all, none (default), exif, icc, xmp 93*b2055c35SXin Li 94*b2055c35SXin Li-short ................. condense printed message 95*b2055c35SXin Li-quiet ................. don't print anything 96*b2055c35SXin Li-version ............... print version number and exit 97*b2055c35SXin Li-noasm ................. disable all assembly optimizations 98*b2055c35SXin Li-v ..................... verbose, e.g. print encoding/decoding times 99*b2055c35SXin Li-progress .............. report encoding progress 100*b2055c35SXin Li``` 101*b2055c35SXin Li 102*b2055c35SXin LiExperimental Options: 103*b2055c35SXin Li 104*b2055c35SXin Li``` 105*b2055c35SXin Li-jpeg_like ............. roughly match expected JPEG size 106*b2055c35SXin Li-af .................... auto-adjust filter strength 107*b2055c35SXin Li-pre <int> ............. pre-processing filter 108*b2055c35SXin Li``` 109*b2055c35SXin Li 110*b2055c35SXin LiThe main options you might want to try in order to further tune the visual 111*b2055c35SXin Liquality are: 112*b2055c35SXin Li 113*b2055c35SXin Li-preset -sns -f -m 114*b2055c35SXin Li 115*b2055c35SXin LiNamely: 116*b2055c35SXin Li 117*b2055c35SXin Li* `preset` will set up a default encoding configuration targeting a particular 118*b2055c35SXin Li type of input. It should appear first in the list of options, so that 119*b2055c35SXin Li subsequent options can take effect on top of this preset. Default value is 120*b2055c35SXin Li 'default'. 121*b2055c35SXin Li* `sns` will progressively turn on (when going from 0 to 100) some additional 122*b2055c35SXin Li visual optimizations (like: segmentation map re-enforcement). This option 123*b2055c35SXin Li will balance the bit allocation differently. It tries to take bits from the 124*b2055c35SXin Li "easy" parts of the picture and use them in the "difficult" ones instead. 125*b2055c35SXin Li Usually, raising the sns value (at fixed -q value) leads to larger files, 126*b2055c35SXin Li but with better quality. Typical value is around '75'. 127*b2055c35SXin Li* `f` option directly links to the filtering strength used by the codec's 128*b2055c35SXin Li in-loop processing. The higher the value, the smoother the highly-compressed 129*b2055c35SXin Li area will look. This is particularly useful when aiming at very small files. 130*b2055c35SXin Li Typical values are around 20-30. Note that using the option 131*b2055c35SXin Li -strong/-nostrong will change the type of filtering. Use "-f 0" to turn 132*b2055c35SXin Li filtering off. 133*b2055c35SXin Li* `m` controls the trade-off between encoding speed and quality. Default is 4. 134*b2055c35SXin Li You can try -m 5 or -m 6 to explore more (time-consuming) encoding 135*b2055c35SXin Li possibilities. A lower value will result in faster encoding at the expense 136*b2055c35SXin Li of quality. 137*b2055c35SXin Li 138*b2055c35SXin Li## Decoding tool 139*b2055c35SXin Li 140*b2055c35SXin LiThere is a decoding sample in examples/dwebp.c which will take a .webp file and 141*b2055c35SXin Lidecode it to a PNG image file (amongst other formats). This is simply to 142*b2055c35SXin Lidemonstrate the use of the API. You can verify the file test.webp decodes to 143*b2055c35SXin Liexactly the same as test_ref.ppm by using: 144*b2055c35SXin Li 145*b2055c35SXin Li```shell 146*b2055c35SXin Licd examples 147*b2055c35SXin Li./dwebp test.webp -ppm -o test.ppm 148*b2055c35SXin Lidiff test.ppm test_ref.ppm 149*b2055c35SXin Li``` 150*b2055c35SXin Li 151*b2055c35SXin LiThe full list of options is available using -h: 152*b2055c35SXin Li 153*b2055c35SXin Li```shell 154*b2055c35SXin Li> dwebp -h 155*b2055c35SXin LiUsage: dwebp in_file [options] [-o out_file] 156*b2055c35SXin Li``` 157*b2055c35SXin Li 158*b2055c35SXin LiDecodes the WebP image file to PNG format [Default]. Note: Animated WebP files 159*b2055c35SXin Liare not supported. 160*b2055c35SXin Li 161*b2055c35SXin LiUse following options to convert into alternate image formats: 162*b2055c35SXin Li 163*b2055c35SXin Li``` 164*b2055c35SXin Li-pam ......... save the raw RGBA samples as a color PAM 165*b2055c35SXin Li-ppm ......... save the raw RGB samples as a color PPM 166*b2055c35SXin Li-bmp ......... save as uncompressed BMP format 167*b2055c35SXin Li-tiff ........ save as uncompressed TIFF format 168*b2055c35SXin Li-pgm ......... save the raw YUV samples as a grayscale PGM 169*b2055c35SXin Li file with IMC4 layout 170*b2055c35SXin Li-yuv ......... save the raw YUV samples in flat layout 171*b2055c35SXin Li``` 172*b2055c35SXin Li 173*b2055c35SXin LiOther options are: 174*b2055c35SXin Li 175*b2055c35SXin Li``` 176*b2055c35SXin Li-version ..... print version number and exit 177*b2055c35SXin Li-nofancy ..... don't use the fancy YUV420 upscaler 178*b2055c35SXin Li-nofilter .... disable in-loop filtering 179*b2055c35SXin Li-nodither .... disable dithering 180*b2055c35SXin Li-dither <d> .. dithering strength (in 0..100) 181*b2055c35SXin Li-alpha_dither use alpha-plane dithering if needed 182*b2055c35SXin Li-mt .......... use multi-threading 183*b2055c35SXin Li-crop <x> <y> <w> <h> ... crop output with the given rectangle 184*b2055c35SXin Li-resize <w> <h> ......... resize output (*after* any cropping) 185*b2055c35SXin Li-flip ........ flip the output vertically 186*b2055c35SXin Li-alpha ....... only save the alpha plane 187*b2055c35SXin Li-incremental . use incremental decoding (useful for tests) 188*b2055c35SXin Li-h ........... this help message 189*b2055c35SXin Li-v ........... verbose (e.g. print encoding/decoding times) 190*b2055c35SXin Li-quiet ....... quiet mode, don't print anything 191*b2055c35SXin Li-noasm ....... disable all assembly optimizations 192*b2055c35SXin Li``` 193*b2055c35SXin Li 194*b2055c35SXin Li## WebP file analysis tool 195*b2055c35SXin Li 196*b2055c35SXin Li`webpinfo` can be used to print out the chunk level structure and bitstream 197*b2055c35SXin Liheader information of WebP files. It can also check if the files are of valid 198*b2055c35SXin LiWebP format. 199*b2055c35SXin Li 200*b2055c35SXin LiUsage: 201*b2055c35SXin Li 202*b2055c35SXin Li```shell 203*b2055c35SXin Liwebpinfo [options] in_files 204*b2055c35SXin Li``` 205*b2055c35SXin Li 206*b2055c35SXin LiNote: there could be multiple input files; options must come before input files. 207*b2055c35SXin Li 208*b2055c35SXin LiOptions: 209*b2055c35SXin Li 210*b2055c35SXin Li``` 211*b2055c35SXin Li-version ........... Print version number and exit. 212*b2055c35SXin Li-quiet ............. Do not show chunk parsing information. 213*b2055c35SXin Li-diag .............. Show parsing error diagnosis. 214*b2055c35SXin Li-summary ........... Show chunk stats summary. 215*b2055c35SXin Li-bitstream_info .... Parse bitstream header. 216*b2055c35SXin Li``` 217*b2055c35SXin Li 218*b2055c35SXin Li## Visualization tool 219*b2055c35SXin Li 220*b2055c35SXin LiThere's a little self-serve visualization tool called 'vwebp' under the 221*b2055c35SXin Liexamples/ directory. It uses OpenGL to open a simple drawing window and show a 222*b2055c35SXin Lidecoded WebP file. It's not yet integrated in the automake build system, but you 223*b2055c35SXin Lican try to manually compile it using the recommendations below. 224*b2055c35SXin Li 225*b2055c35SXin LiUsage: 226*b2055c35SXin Li 227*b2055c35SXin Li```shell 228*b2055c35SXin Livwebp in_file [options] 229*b2055c35SXin Li``` 230*b2055c35SXin Li 231*b2055c35SXin LiDecodes the WebP image file and visualize it using OpenGL 232*b2055c35SXin Li 233*b2055c35SXin LiOptions are: 234*b2055c35SXin Li 235*b2055c35SXin Li``` 236*b2055c35SXin Li-version ..... print version number and exit 237*b2055c35SXin Li-noicc ....... don't use the icc profile if present 238*b2055c35SXin Li-nofancy ..... don't use the fancy YUV420 upscaler 239*b2055c35SXin Li-nofilter .... disable in-loop filtering 240*b2055c35SXin Li-dither <int> dithering strength (0..100), default=50 241*b2055c35SXin Li-noalphadither disable alpha plane dithering 242*b2055c35SXin Li-usebgcolor .. display background color 243*b2055c35SXin Li-mt .......... use multi-threading 244*b2055c35SXin Li-info ........ print info 245*b2055c35SXin Li-h ........... this help message 246*b2055c35SXin Li``` 247*b2055c35SXin Li 248*b2055c35SXin LiKeyboard shortcuts: 249*b2055c35SXin Li 250*b2055c35SXin Li``` 251*b2055c35SXin Li'c' ................ toggle use of color profile 252*b2055c35SXin Li'b' ................ toggle background color display 253*b2055c35SXin Li'i' ................ overlay file information 254*b2055c35SXin Li'd' ................ disable blending & disposal (debug) 255*b2055c35SXin Li'q' / 'Q' / ESC .... quit 256*b2055c35SXin Li``` 257*b2055c35SXin Li 258*b2055c35SXin Li### Building 259*b2055c35SXin Li 260*b2055c35SXin LiPrerequisites: 261*b2055c35SXin Li 262*b2055c35SXin Li1. OpenGL & OpenGL Utility Toolkit (GLUT) 263*b2055c35SXin Li 264*b2055c35SXin Li Linux: `sudo apt-get install freeglut3-dev mesa-common-dev` 265*b2055c35SXin Li 266*b2055c35SXin Li Mac + Xcode: These libraries should be available in the OpenGL / GLUT 267*b2055c35SXin Li frameworks. 268*b2055c35SXin Li 269*b2055c35SXin Li Windows: http://freeglut.sourceforge.net/index.php#download 270*b2055c35SXin Li 271*b2055c35SXin Li2. (Optional) qcms (Quick Color Management System) 272*b2055c35SXin Li 273*b2055c35SXin Li 1. Download qcms from Mozilla / Chromium: 274*b2055c35SXin Li https://hg.mozilla.org/mozilla-central/file/0e7639e3bdfb/gfx/qcms 275*b2055c35SXin Li https://source.chromium.org/chromium/chromium/src/+/main:third_party/qcms/;drc=d4a2f8e1ed461d8fc05ed88d1ae2dc94c9773825 276*b2055c35SXin Li 2. Build and archive the source files as libqcms.a / qcms.lib 277*b2055c35SXin Li 3. Update makefile.unix / Makefile.vc 278*b2055c35SXin Li 1. Define WEBP_HAVE_QCMS 279*b2055c35SXin Li 2. Update include / library paths to reference the qcms directory. 280*b2055c35SXin Li 281*b2055c35SXin LiBuild using makefile.unix / Makefile.vc: 282*b2055c35SXin Li 283*b2055c35SXin Li```shell 284*b2055c35SXin Li$ make -f makefile.unix examples/vwebp 285*b2055c35SXin Li> nmake /f Makefile.vc CFG=release-static \ 286*b2055c35SXin Li ../obj/x64/release-static/bin/vwebp.exe 287*b2055c35SXin Li``` 288*b2055c35SXin Li 289*b2055c35SXin Li## Animation creation tool 290*b2055c35SXin Li 291*b2055c35SXin LiThe utility `img2webp` can turn a sequence of input images (PNG, JPEG, ...) into 292*b2055c35SXin Lian animated WebP file. It offers fine control over duration, encoding modes, 293*b2055c35SXin Lietc. 294*b2055c35SXin Li 295*b2055c35SXin LiUsage: 296*b2055c35SXin Li 297*b2055c35SXin Li```shell 298*b2055c35SXin Liimg2webp [file_options] [[frame_options] frame_file]... [-o webp_file] 299*b2055c35SXin Li``` 300*b2055c35SXin Li 301*b2055c35SXin LiFile-level options (only used at the start of compression): 302*b2055c35SXin Li 303*b2055c35SXin Li``` 304*b2055c35SXin Li-min_size ............ minimize size 305*b2055c35SXin Li-kmax <int> .......... maximum number of frame between key-frames 306*b2055c35SXin Li (0=only keyframes) 307*b2055c35SXin Li-kmin <int> .......... minimum number of frame between key-frames 308*b2055c35SXin Li (0=disable key-frames altogether) 309*b2055c35SXin Li-mixed ............... use mixed lossy/lossless automatic mode 310*b2055c35SXin Li-near_lossless <int> . use near-lossless image preprocessing 311*b2055c35SXin Li (0..100=off), default=100 312*b2055c35SXin Li-sharp_yuv ........... use sharper (and slower) RGB->YUV conversion 313*b2055c35SXin Li (lossy only) 314*b2055c35SXin Li-loop <int> .......... loop count (default: 0, = infinite loop) 315*b2055c35SXin Li-v ................... verbose mode 316*b2055c35SXin Li-h ................... this help 317*b2055c35SXin Li-version ............. print version number and exit 318*b2055c35SXin Li``` 319*b2055c35SXin Li 320*b2055c35SXin LiPer-frame options (only used for subsequent images input): 321*b2055c35SXin Li 322*b2055c35SXin Li``` 323*b2055c35SXin Li-d <int> ............. frame duration in ms (default: 100) 324*b2055c35SXin Li-lossless ........... use lossless mode (default) 325*b2055c35SXin Li-lossy ... ........... use lossy mode 326*b2055c35SXin Li-q <float> ........... quality 327*b2055c35SXin Li-m <int> ............. method to use 328*b2055c35SXin Li``` 329*b2055c35SXin Li 330*b2055c35SXin Liexample: `img2webp -loop 2 in0.png -lossy in1.jpg -d 80 in2.tiff -o out.webp` 331*b2055c35SXin Li 332*b2055c35SXin LiNote: if a single file name is passed as the argument, the arguments will be 333*b2055c35SXin Litokenized from this file. The file name must not start with the character '-'. 334*b2055c35SXin Li 335*b2055c35SXin Li## Animated GIF conversion 336*b2055c35SXin Li 337*b2055c35SXin LiAnimated GIF files can be converted to WebP files with animation using the 338*b2055c35SXin Ligif2webp utility available under examples/. The files can then be viewed using 339*b2055c35SXin Livwebp. 340*b2055c35SXin Li 341*b2055c35SXin LiUsage: 342*b2055c35SXin Li 343*b2055c35SXin Li```shell 344*b2055c35SXin Ligif2webp [options] gif_file -o webp_file 345*b2055c35SXin Li``` 346*b2055c35SXin Li 347*b2055c35SXin LiOptions: 348*b2055c35SXin Li 349*b2055c35SXin Li``` 350*b2055c35SXin Li-h / -help ............. this help 351*b2055c35SXin Li-lossy ................. encode image using lossy compression 352*b2055c35SXin Li-mixed ................. for each frame in the image, pick lossy 353*b2055c35SXin Li or lossless compression heuristically 354*b2055c35SXin Li-q <float> ............. quality factor (0:small..100:big) 355*b2055c35SXin Li-m <int> ............... compression method (0=fast, 6=slowest) 356*b2055c35SXin Li-min_size .............. minimize output size (default:off) 357*b2055c35SXin Li lossless compression by default; can be 358*b2055c35SXin Li combined with -q, -m, -lossy or -mixed 359*b2055c35SXin Li options 360*b2055c35SXin Li-kmin <int> ............ min distance between key frames 361*b2055c35SXin Li-kmax <int> ............ max distance between key frames 362*b2055c35SXin Li-f <int> ............... filter strength (0=off..100) 363*b2055c35SXin Li-metadata <string> ..... comma separated list of metadata to 364*b2055c35SXin Li copy from the input to the output if present 365*b2055c35SXin Li Valid values: all, none, icc, xmp (default) 366*b2055c35SXin Li-loop_compatibility .... use compatibility mode for Chrome 367*b2055c35SXin Li version prior to M62 (inclusive) 368*b2055c35SXin Li-mt .................... use multi-threading if available 369*b2055c35SXin Li 370*b2055c35SXin Li-version ............... print version number and exit 371*b2055c35SXin Li-v ..................... verbose 372*b2055c35SXin Li-quiet ................. don't print anything 373*b2055c35SXin Li``` 374*b2055c35SXin Li 375*b2055c35SXin Li### Building 376*b2055c35SXin Li 377*b2055c35SXin LiWith the libgif development files installed, gif2webp can be built using 378*b2055c35SXin Limakefile.unix: 379*b2055c35SXin Li 380*b2055c35SXin Li```shell 381*b2055c35SXin Li$ make -f makefile.unix examples/gif2webp 382*b2055c35SXin Li``` 383*b2055c35SXin Li 384*b2055c35SXin Lior using autoconf: 385*b2055c35SXin Li 386*b2055c35SXin Li```shell 387*b2055c35SXin Li$ ./configure --enable-everything 388*b2055c35SXin Li$ make 389*b2055c35SXin Li``` 390*b2055c35SXin Li 391*b2055c35SXin Li## Comparison of animated images 392*b2055c35SXin Li 393*b2055c35SXin LiTest utility anim_diff under examples/ can be used to compare two animated 394*b2055c35SXin Liimages (each can be GIF or WebP). 395*b2055c35SXin Li 396*b2055c35SXin LiUsage: 397*b2055c35SXin Li 398*b2055c35SXin Li```shell 399*b2055c35SXin Lianim_diff <image1> <image2> [options] 400*b2055c35SXin Li``` 401*b2055c35SXin Li 402*b2055c35SXin LiOptions: 403*b2055c35SXin Li 404*b2055c35SXin Li``` 405*b2055c35SXin Li-dump_frames <folder> dump decoded frames in PAM format 406*b2055c35SXin Li-min_psnr <float> ... minimum per-frame PSNR 407*b2055c35SXin Li-raw_comparison ..... if this flag is not used, RGB is 408*b2055c35SXin Li premultiplied before comparison 409*b2055c35SXin Li-max_diff <int> ..... maximum allowed difference per channel 410*b2055c35SXin Li between corresponding pixels in subsequent 411*b2055c35SXin Li frames 412*b2055c35SXin Li-h .................. this help 413*b2055c35SXin Li-version ............ print version number and exit 414*b2055c35SXin Li``` 415*b2055c35SXin Li 416*b2055c35SXin Li### Building 417*b2055c35SXin Li 418*b2055c35SXin LiWith the libgif development files installed, anim_diff can be built using 419*b2055c35SXin Limakefile.unix: 420*b2055c35SXin Li 421*b2055c35SXin Li```shell 422*b2055c35SXin Li$ make -f makefile.unix examples/anim_diff 423*b2055c35SXin Li``` 424*b2055c35SXin Li 425*b2055c35SXin Lior using autoconf: 426*b2055c35SXin Li 427*b2055c35SXin Li```shell 428*b2055c35SXin Li$ ./configure --enable-everything 429*b2055c35SXin Li$ make 430*b2055c35SXin Li``` 431*b2055c35SXin Li 432*b2055c35SXin Li## WebP Mux tool 433*b2055c35SXin Li 434*b2055c35SXin LiThe examples/ directory contains a tool (webpmux) for manipulating WebP files. 435*b2055c35SXin LiThe webpmux tool can be used to create an extended format WebP file and also to 436*b2055c35SXin Liextract or strip relevant data from such a file. 437*b2055c35SXin Li 438*b2055c35SXin LiA list of options is available using the -help command line flag: 439*b2055c35SXin Li 440*b2055c35SXin Li```shell 441*b2055c35SXin Li> webpmux -help 442*b2055c35SXin LiUsage: webpmux -get GET_OPTIONS INPUT -o OUTPUT 443*b2055c35SXin Li webpmux -set SET_OPTIONS INPUT -o OUTPUT 444*b2055c35SXin Li webpmux -duration DURATION_OPTIONS [-duration ...] 445*b2055c35SXin Li INPUT -o OUTPUT 446*b2055c35SXin Li webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT 447*b2055c35SXin Li webpmux -frame FRAME_OPTIONS [-frame...] [-loop LOOP_COUNT] 448*b2055c35SXin Li [-bgcolor BACKGROUND_COLOR] -o OUTPUT 449*b2055c35SXin Li webpmux -info INPUT 450*b2055c35SXin Li webpmux [-h|-help] 451*b2055c35SXin Li webpmux -version 452*b2055c35SXin Li webpmux argument_file_name 453*b2055c35SXin Li 454*b2055c35SXin LiGET_OPTIONS: 455*b2055c35SXin Li Extract relevant data: 456*b2055c35SXin Li icc get ICC profile 457*b2055c35SXin Li exif get EXIF metadata 458*b2055c35SXin Li xmp get XMP metadata 459*b2055c35SXin Li frame n get nth frame 460*b2055c35SXin Li 461*b2055c35SXin LiSET_OPTIONS: 462*b2055c35SXin Li Set color profile/metadata/parameters: 463*b2055c35SXin Li loop LOOP_COUNT set the loop count 464*b2055c35SXin Li bgcolor BACKGROUND_COLOR set the animation background color 465*b2055c35SXin Li icc file.icc set ICC profile 466*b2055c35SXin Li exif file.exif set EXIF metadata 467*b2055c35SXin Li xmp file.xmp set XMP metadata 468*b2055c35SXin Li where: 'file.icc' contains the ICC profile to be set, 469*b2055c35SXin Li 'file.exif' contains the EXIF metadata to be set 470*b2055c35SXin Li 'file.xmp' contains the XMP metadata to be set 471*b2055c35SXin Li 472*b2055c35SXin LiDURATION_OPTIONS: 473*b2055c35SXin Li Set duration of selected frames: 474*b2055c35SXin Li duration set duration for all frames 475*b2055c35SXin Li duration,frame set duration of a particular frame 476*b2055c35SXin Li duration,start,end set duration of frames in the 477*b2055c35SXin Li interval [start,end]) 478*b2055c35SXin Li where: 'duration' is the duration in milliseconds 479*b2055c35SXin Li 'start' is the start frame index 480*b2055c35SXin Li 'end' is the inclusive end frame index 481*b2055c35SXin Li The special 'end' value '0' means: last frame. 482*b2055c35SXin Li 483*b2055c35SXin LiSTRIP_OPTIONS: 484*b2055c35SXin Li Strip color profile/metadata: 485*b2055c35SXin Li icc strip ICC profile 486*b2055c35SXin Li exif strip EXIF metadata 487*b2055c35SXin Li xmp strip XMP metadata 488*b2055c35SXin Li 489*b2055c35SXin LiFRAME_OPTIONS(i): 490*b2055c35SXin Li Create animation: 491*b2055c35SXin Li file_i +di[+xi+yi[+mi[bi]]] 492*b2055c35SXin Li where: 'file_i' is the i'th animation frame (WebP format), 493*b2055c35SXin Li 'di' is the pause duration before next frame, 494*b2055c35SXin Li 'xi','yi' specify the image offset for this frame, 495*b2055c35SXin Li 'mi' is the dispose method for this frame (0 or 1), 496*b2055c35SXin Li 'bi' is the blending method for this frame (+b or -b) 497*b2055c35SXin Li 498*b2055c35SXin LiLOOP_COUNT: 499*b2055c35SXin Li Number of times to repeat the animation. 500*b2055c35SXin Li Valid range is 0 to 65535 [Default: 0 (infinite)]. 501*b2055c35SXin Li 502*b2055c35SXin LiBACKGROUND_COLOR: 503*b2055c35SXin Li Background color of the canvas. 504*b2055c35SXin Li A,R,G,B 505*b2055c35SXin Li where: 'A', 'R', 'G' and 'B' are integers in the range 0 to 255 specifying 506*b2055c35SXin Li the Alpha, Red, Green and Blue component values respectively 507*b2055c35SXin Li [Default: 255,255,255,255] 508*b2055c35SXin Li 509*b2055c35SXin LiINPUT & OUTPUT are in WebP format. 510*b2055c35SXin Li 511*b2055c35SXin LiNote: The nature of EXIF, XMP and ICC data is not checked and is assumed to be 512*b2055c35SXin Livalid. 513*b2055c35SXin Li 514*b2055c35SXin LiNote: if a single file name is passed as the argument, the arguments will be 515*b2055c35SXin Litokenized from this file. The file name must not start with the character '-'. 516*b2055c35SXin Li``` 517