Decode animation on the fly with libwebp 1.1

23 views
Skip to first unread message

Dmitry Baryshev

unread,
Jul 22, 2021, 5:25:23 PM7/22/21
to WebP Discussion
Hi! :)

https://developers.google.com/speed/webp/docs/api#advanced_decoding_api demonstrates how to decode a static image on the fly (e.g. coming from a network source) using WebPIAppend/WebPIDecGetRGB.

Is it possible to do the same for animations?

Or, better, is it possible to supply my own data reading function like we can do with libpng (png_set_read_fn) or libtiff (TIFFClientOpen)?

Thanks in advance!

James Zern

unread,
Jul 22, 2021, 9:12:59 PM7/22/21
to WebP Discussion
Hi,

On Thu, Jul 22, 2021 at 2:25 PM Dmitry Baryshev <dmit...@gmail.com> wrote:
Hi! :)

https://developers.google.com/speed/webp/docs/api#advanced_decoding_api demonstrates how to decode a static image on the fly (e.g. coming from a network source) using WebPIAppend/WebPIDecGetRGB.

Is it possible to do the same for animations?

Yes, but not through the WebPAnimDecoder interface. You'd need to use the demuxer (or manually parse the file) and decode the images with WebPIAppend/WebPIUpdate. The demuxer will need to be recreated with new data, however. This is something that we may improve in the future. Chrome is a good example of using the decoder [1], it handles the reconstruction of the animation similar to the WebPAnimDecoder interface.
 

Or, better, is it possible to supply my own data reading function like we can do with libpng (png_set_read_fn) or libtiff (TIFFClientOpen)?

We have writer functions for the encoder, but no reader functions for the decoder.

 

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
To view this discussion on the web visit https://groups.google.com/a/webmproject.org/d/msgid/webp-discuss/72bf407e-f5d6-48db-b1ac-02f3d215db5bn%40webmproject.org.

Dmitry Baryshev

unread,
Jul 23, 2021, 8:59:08 AM7/23/21
to WebP Discussion, James Zern

> Yes, but not through the WebPAnimDecoder interface. You'd need to use the demuxer (or manually parse the file) and decode the images with WebPIAppend/WebPIUpdate. The demuxer will need to be recreated with new data, however. This is something that we may improve in the future.

Thanks! It would be great to have an I/O abstraction layer like we have in libpng/libtiff/giflib/etc. supported in all libwebp components (decoder, demuxer etc.). The current approach with WebPIAppend doesn't look like an abstraction and introduces issues with using libwebp in abstract imaging libraries.

пятница, 23 июля 2021 г. в 04:12:59 UTC+3, James Zern:
Reply all
Reply to author
Forward
0 new messages