mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 14:34:33 +02:00
MUX API Updates
- Add alpha support in mux. - Remove WebPMuxAddNamedData() and WebPMuxGetNamedData() APIs. Add WebPMuxSetImage(), WebPmuxGetImage() and WebPMuxDeleteImage() APIs instead. - Refactor code using WebPImage struct. - Corresponding changes in webpmux binary. - WebPMuxSetImage()/AddFrame()/AddTile() can now work with data which starts from "RIFF...". This simplifies reading a single-image webp file and adding it as an image/frame/tile in mux. Change-Id: I7d98a6407dfe55c84a682ef7e46bc622f5a6f8d9
This commit is contained in:
@ -73,7 +73,8 @@ metadata.
|
||||
int copy_data = 0;
|
||||
WebPMux* mux = WebPMuxNew();
|
||||
// ... (Prepare image data).
|
||||
WebPMuxAddNamedData(mux, 1, "image", image_data, image_data_size, copy_data);
|
||||
WebPMuxSetImage(mux, image_data, image_data_size, alpha_data, alpha_size,
|
||||
copy_data);
|
||||
// ... (Prepare ICCP color profile data).
|
||||
WebPMuxSetColorProfile(mux, icc_data, icc_data_size, copy_data);
|
||||
// ... (Prepare XMP metadata).
|
||||
@ -90,7 +91,8 @@ Example#2 (pseudo code): Get image & color profile data from a WebP file.
|
||||
int copy_data = 0;
|
||||
// ... (Read data from file).
|
||||
WebPMux* mux = WebPMuxCreate(data, data_size, copy_data);
|
||||
WebPMuxGetNamedData(mux, "image", 1, &image_data, &image_data_size);
|
||||
WebPMuxGetImage(mux, &image_data, &image_data_size,
|
||||
&alpha_data, &alpha_size);
|
||||
// ... (Consume image_data; e.g. call WebPDecode() to decode the data).
|
||||
WebPMuxGetColorProfile(mux, &icc_data, &icc_data_size);
|
||||
// ... (Consume icc_data).
|
||||
|
Reference in New Issue
Block a user