1 __ __ ____ ____ ____ __ __ _ __ __
2 / \\/ \/ _ \/ _ \/ _ \/ \ \/ \___/_ / _\
3 \ / __/ _ \ __/ / / (_/ /__
4 \__\__/\_____/_____/__/ \__//_/\_____/__/___/v0.1.0
10 WebPMux: set of two libraries 'Mux' and 'Demux' for creation, extraction and
11 manipulation of an extended format WebP file, which can have features like
12 color profile, metadata and animation. Reference command-line tools 'webpmux'
13 and 'vwebp' as well as the WebP container specification
14 'doc/webp-container-spec.txt' are also provided in this package.
19 The examples/ directory contains a tool (webpmux) for manipulating WebP
20 files. The webpmux tool can be used to create an extended format WebP file and
21 also to extract or strip relevant data from such a file.
23 A list of options is available using the -help command line flag:
26 Usage: webpmux -get GET_OPTIONS INPUT -o OUTPUT
27 webpmux -set SET_OPTIONS INPUT -o OUTPUT
28 webpmux -strip STRIP_OPTIONS INPUT -o OUTPUT
29 webpmux -frame FRAME_OPTIONS [-frame...] [-loop LOOP_COUNT]
30 [-bgcolor BACKGROUND_COLOR] -o OUTPUT
36 Extract relevant data.
38 exif Get EXIF metadata.
40 frame n Get nth frame.
43 Set color profile/metadata.
44 icc file.icc Set ICC profile.
45 exif file.exif Set EXIF metadata.
46 xmp file.xmp Set XMP metadata.
47 where: 'file.icc' contains the ICC profile to be set,
48 'file.exif' contains the EXIF metadata to be set
49 'file.xmp' contains the XMP metadata to be set
52 Strip color profile/metadata.
53 icc Strip ICC profile.
54 exif Strip EXIF metadata.
55 xmp Strip XMP metadata.
60 where: 'file_i' is the i'th animation frame (WebP format),
61 'di' is the pause duration before next frame.
62 'xi','yi' specify the image offset for this frame.
63 'mi' is the dispose method for this frame (0 or 1).
66 Number of times to repeat the animation.
67 Valid range is 0 to 65535 [Default: 0 (infinite)].
70 Background color of the canvas.
72 where: 'A', 'R', 'G' and 'B' are integers in the range 0 to 255 specifying
73 the Alpha, Red, Green and Blue component values respectively
74 [Default: 255,255,255,255].
76 INPUT & OUTPUT are in WebP format.
78 Note: The nature of EXIF, XMP and ICC data is not checked and is assumed to be
84 The examples/ directory also contains a tool (vwebp) for viewing WebP files.
85 It decodes the image and visualizes it using OpenGL. See the libwebp README
86 for details on building and running this program.
90 The Mux API contains methods for adding data to and reading data from WebP
91 files. This API currently supports XMP/EXIF metadata, ICC profile and animation.
92 Other features may be added in subsequent releases.
94 Example#1 (pseudo code): Creating a WebPMux object with image data, color
95 profile and XMP metadata.
98 WebPMux* mux = WebPMuxNew();
99 // ... (Prepare image data).
100 WebPMuxSetImage(mux, &image, copy_data);
101 // ... (Prepare ICC profile data).
102 WebPMuxSetChunk(mux, "ICCP", &icc_profile, copy_data);
103 // ... (Prepare XMP metadata).
104 WebPMuxSetChunk(mux, "XMP ", &xmp, copy_data);
105 // Get data from mux in WebP RIFF format.
106 WebPMuxAssemble(mux, &output_data);
108 // ... (Consume output_data; e.g. write output_data.bytes to file).
109 WebPDataClear(&output_data);
112 Example#2 (pseudo code): Get image and color profile data from a WebP file.
115 // ... (Read data from file).
116 WebPMux* mux = WebPMuxCreate(&data, copy_data);
117 WebPMuxGetFrame(mux, 1, &image);
118 // ... (Consume image; e.g. call WebPDecode() to decode the data).
119 WebPMuxGetChunk(mux, "ICCP", &icc_profile);
120 // ... (Consume icc_profile).
125 For a detailed Mux API reference, please refer to the header file
130 The Demux API enables extraction of images and extended format data from
131 WebP files. This API currently supports reading of XMP/EXIF metadata, ICC
132 profile and animated images. Other features may be added in subsequent
135 Code Example: Demuxing WebP data to extract all the frames, ICC profile
136 and EXIF/XMP metadata.
138 WebPDemuxer* demux = WebPDemux(&webp_data);
139 uint32_t width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
140 uint32_t height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
141 // ... (Get information about the features present in the WebP file).
142 uint32_t flags = WebPDemuxGetI(demux, WEBP_FF_FORMAT_FLAGS);
144 // ... (Iterate over all frames).
146 if (WebPDemuxGetFrame(demux, 1, &iter)) {
148 // ... (Consume 'iter'; e.g. Decode 'iter.fragment' with WebPDecode(),
149 // ... and get other frame properties like width, height, offsets etc.
150 // ... see 'struct WebPIterator' below for more info).
151 } while (WebPDemuxNextFrame(&iter));
152 WebPDemuxReleaseIterator(&iter);
155 // ... (Extract metadata).
156 WebPChunkIterator chunk_iter;
157 if (flags & ICCP_FLAG) WebPDemuxGetChunk(demux, "ICCP", 1, &chunk_iter);
158 // ... (Consume the ICC profile in 'chunk_iter.chunk').
159 WebPDemuxReleaseChunkIterator(&chunk_iter);
160 if (flags & EXIF_FLAG) WebPDemuxGetChunk(demux, "EXIF", 1, &chunk_iter);
161 // ... (Consume the EXIF metadata in 'chunk_iter.chunk').
162 WebPDemuxReleaseChunkIterator(&chunk_iter);
163 if (flags & XMP_FLAG) WebPDemuxGetChunk(demux, "XMP ", 1, &chunk_iter);
164 // ... (Consume the XMP metadata in 'chunk_iter.chunk').
165 WebPDemuxReleaseChunkIterator(&chunk_iter);
166 WebPDemuxDelete(demux);
169 For a detailed Demux API reference, please refer to the header file
176 Please report all bugs to our issue tracker:
177 http://code.google.com/p/webp/issues
178 Patches welcome! See this page to get started:
179 http://www.webmproject.org/code/contribute/submitting-patches/
184 Email: webp-discuss@webmproject.org
185 Web: http://groups.google.com/a/webmproject.org/group/webp-discuss