ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 WebP files
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

HeartWare

Denmark
49 Posts

Posted - Dec 18 2023 :  12:37:51  Show Profile  Reply
Is it possible - and if so, how? - to detect if a .webp file is saved as lossy or lossless format, using standard ImageEn components?

If not using ImageEn, does anyone know how to detect it?

xequte

38457 Posts

Posted - Dec 18 2023 :  18:36:21  Show Profile  Reply
Hi

ImageEn supports WebP via WIC, ImageMagick and Skia (>= Delphi 12). Unfortunately none of these methods output a valid compression property.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

HeartWare

Denmark
49 Posts

Posted - Dec 19 2023 :  00:38:53  Show Profile  Reply
Okay.

I found another way - if the bytes at offset 12 in the file is "VP8L" then it is a lossless compression (after checking bytes at offset 0 ="RIFF" and at offset 8 = "WEBP"). Lossy compression is "VP8 " (notice the trailing space) at offset 12.
Go to Top of Page

xequte

38457 Posts

Posted - Dec 19 2023 :  21:23:59  Show Profile  Reply
Hi

Yes, unfortunately though, you may find that there are other "chunks" before the image chunk.

https://developers.google.com/speed/webp/docs/riff_container

Most commonly is a VP8X chunk. You would have to skip that and locate the "VP8L"/"VP8 " FourCC.

E.g. attach/xequte/20231219212424_4_webp_LossyAlpha.webp

Nigel
Xequte Software
www.imageen.com


Go to Top of Page

HeartWare

Denmark
49 Posts

Posted - Dec 21 2023 :  00:35:40  Show Profile  Reply
Thank you for the heads-up. I'll update my detection routine to handle this...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: