mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 13:18:22 +01:00
fa30c86323
- Allow a duration of 0 - Rename LOOP chunk to ANIM and add the background color field to it. - Add a disposal method field for each animation frame. - Modify webpmux.c binary interface to allow the input of background color and disposal methods. Also make '-loop' and '-bgcolor' arguments optional with some default values. Change-Id: I807372a61cdb8a0d3080ae3552caf2848070bf4d
140 lines
4.5 KiB
Plaintext
140 lines
4.5 KiB
Plaintext
__ __ ____ ____ ____ __ __ _ __ __
|
|
/ \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\
|
|
\ / __/ _ \ __/ / / (_/ /__
|
|
\__\__/\_____/_____/__/ \__//_/\_____/__/___/
|
|
|
|
|
|
Description:
|
|
============
|
|
|
|
WebP Mux: library to create a WebP container object for features like
|
|
color profile, metadata, animation and fragmented images. A reference command
|
|
line tool 'webpmux' and WebP container specification
|
|
'doc/webp-container-spec.txt' are also provided in this package.
|
|
|
|
WebP Mux tool:
|
|
==============
|
|
|
|
The examples/ directory contains a tool (webpmux) for manipulating WebP
|
|
files. The webpmux tool can be used to create a WebP container file and to
|
|
extract or strip relevant data from the container file.
|
|
|
|
A list of options is available using the -help command line flag:
|
|
|
|
> webpmux -help
|
|
Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT
|
|
webpmux -set SET_OPTIONS INPUT -o OUTPUT
|
|
webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT
|
|
webpmux -frgm FRAGMENT_OPTIONS [-frgm...] -o OUTPUT
|
|
webpmux -frame FRAME_OPTIONS [-frame...] [-loop LOOP_COUNT]
|
|
[-bgcolor BACKGROUND_COLOR] -o OUTPUT
|
|
webpmux -info INPUT
|
|
webpmux [-h|-help]
|
|
|
|
GET_OPTIONS:
|
|
Extract relevant data.
|
|
icc Get ICC profile.
|
|
exif Get EXIF metadata.
|
|
xmp Get XMP metadata.
|
|
frgm n Get nth fragment.
|
|
frame n Get nth frame.
|
|
|
|
SET_OPTIONS:
|
|
Set color profile/metadata.
|
|
icc file.icc Set ICC profile.
|
|
exif file.exif Set EXIF metadata.
|
|
xmp file.xmp Set XMP metadata.
|
|
where: 'file.icc' contains the ICC profile to be set,
|
|
'file.exif' contains the EXIF metadata to be set and
|
|
'file.xmp' contains the XMP metadata to be set
|
|
|
|
STRIP_OPTIONS:
|
|
Strip color profile/metadata.
|
|
icc Strip ICC profile.
|
|
exif Strip EXIF metadata.
|
|
xmp Strip XMP metadata.
|
|
|
|
FRAGMENT_OPTIONS(i):
|
|
Create fragmented image.
|
|
file_i +xi+yi
|
|
where: 'file_i' is the i'th fragment (WebP format),
|
|
'xi','yi' specify the image offset for this fragment.
|
|
|
|
FRAME_OPTIONS(i):
|
|
Create animation.
|
|
file_i +xi+yi+di+mi
|
|
where: 'file_i' is the i'th animation frame (WebP format),
|
|
'xi','yi' specify the image offset for this frame.
|
|
'di' is the pause duration before next frame.
|
|
'mi' is the dispose method for this frame (0 or 1).
|
|
|
|
LOOP_COUNT:
|
|
Number of times to repeat the animation.
|
|
Valid range is 0 to 65535 [Default: 0 (infinite)].
|
|
|
|
BACKGROUND_COLOR:
|
|
Background color of the canvas.
|
|
A,R,G,B
|
|
where: 'A', 'R', 'G' and 'B' are integers in the range 0 to 255 specifying
|
|
the Alpha, Red, Green and Blue component values respectively
|
|
[Default: 255,255,255,255].
|
|
|
|
INPUT & OUTPUT are in WebP format.
|
|
|
|
Note: The nature of EXIF, XMP and ICC data is not checked and is assumed to be
|
|
valid.
|
|
|
|
WebP Mux API:
|
|
==============
|
|
The WebP Mux API contains methods for adding data to and reading data from
|
|
WebPMux (a WebP container object). This API currently supports XMP/EXIF
|
|
metadata, ICC profile, animation and fragmented images. Other features
|
|
will be added in subsequent releases.
|
|
|
|
Example#1 (pseudo code): Creating a WebPMux object with image data, color
|
|
profile and XMP metadata.
|
|
|
|
int copy_data = 0;
|
|
WebPMux* mux = WebPMuxNew();
|
|
// ... (Prepare image data).
|
|
WebPMuxSetImage(mux, &image, copy_data);
|
|
// ... (Prepare ICC profile data).
|
|
WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);
|
|
// ... (Prepare XMP metadata).
|
|
WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);
|
|
// Get data from mux in WebP RIFF format.
|
|
WebPMuxAssemble(mux, &output_data);
|
|
WebPMuxDelete(mux);
|
|
// ... (Consume output_data; e.g. write output_data.bytes to file).
|
|
WebPDataClear(&output_data);
|
|
|
|
|
|
Example#2 (pseudo code): Get image and color profile data from a WebP file.
|
|
|
|
int copy_data = 0;
|
|
// ... (Read data from file).
|
|
WebPMux* mux = WebPMuxCreate(&data, copy_data);
|
|
WebPMuxGetFrame(mux, 1, &image);
|
|
// ... (Consume image; e.g. call WebPDecode() to decode the data).
|
|
WebPMuxGetChunk(mux, "ICCP", &icc_profile);
|
|
// ... (Consume icc_profile).
|
|
WebPMuxDelete(mux);
|
|
free(data);
|
|
|
|
|
|
For detailed Mux API reference, please refer to the header file (src/webp/mux.h)
|
|
|
|
Bugs:
|
|
=====
|
|
|
|
Please report all bugs to our issue tracker:
|
|
http://code.google.com/p/webp/issues
|
|
Patches welcome! See this page to get started:
|
|
http://www.webmproject.org/code/contribute/submitting-patches/
|
|
|
|
Discuss:
|
|
========
|
|
|
|
Email: webp-discuss@webmproject.org
|
|
Web: http://groups.google.com/a/webmproject.org/group/webp-discuss
|