It is currently Mon Sep 28, 2020 7:13 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: WebP Imageplugin
PostPosted: Sun Sep 02, 2012 11:47 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 19, 2005 5:05 pm
Posts: 1769
Location: Norway
https://developers.google.com/speed/webp/

v0.2.0 seems very mature, and is the one used in Chrome AFAIK.

A image plugin is kind of a must for PureBasic since trying to use libwebp.lib with PB is kinda cumbersome as the image is upside down and a raw bitmap, so you have to use startdrawing() and imageoutput() and drawingbuffer() and a loop to flip the image vertically, while ideally the webp image should just be decoded and written directly to a image bitmap buffer in the right order.

WebP (Lossless) has aprox. 25% better compression than PNG.
WebP (Lossy) has aprox. 25% better compression than JPG.
WebP lossless with alpha takes up around the same size as a PNG without alpha.
WebP can have a lossy image but lossless alpha.
WebP can also have lossy alpha.
Both lossy and lossless have either quality or compression settings.

If a WebP plugin is made loading and saving would be like this:
LoadImage() is the same as the others.


SaveImage(#Image, Filename$ [, ImagePlugin [, Flags [, Depth]]]) ;this one is a little more complex.

New constant #PB_ImagePlugin_WEBP (or #PB_ImagePlugin_WebP ?)

Flags: Quality, a value from 0 to 100, with 100 being the same as WebP lossless mode, 100 to 106 being lossless compression speed 0 to 6 with 100 being fastest and 106 slowest.
Depth: optional, 8, 24, 32 (1 and 4 as well?)

Why this way? Because by the looks of it the webp example tools either use floating point from 0.0 to 1.0 or from 0 to 100 for lossy quality. And Lossless WebP is a different mode and has 7 different compression speeds (and thus compression rates, but they all are lossless) ranging 0 to 6. And this avoids having to change the function params.

And is WebP worth the effort? Absolutely. First of all it's under a similar license to the xml library. (basically it's the BSD license) so it ca be used in closed source/proprietary/commercial projects.

And more importantly the size reduction. A PNG image here that was 219KB (after optimized using 3 different PNG optimizers) became only 167KB with WebP lossless mode, that's around 30% size reduction.
See http://en.wikipedia.org/wiki/WebP#Support for a growing list of what supports WebP. Also lates Firefox releases also support WebP, so the list on wikipedia is a little outdated.

For WebP lossless decoding speed (which is as important as the compression IMO) https://developers.google.com/speed/web ... lpha_study (look at Table 3. Average decoding time).


OK! I'll stop gushing and shut up now... But WebP has really impressed me.


Top
 Profile  
Reply with quote  
 Post subject: Re: WebP Imageplugin
PostPosted: Thu Mar 12, 2020 6:41 pm 
Offline
User
User
User avatar

Joined: Thu Sep 25, 2008 7:12 am
Posts: 21
Location: Germany
+1

EncodeImage() would be most important for me right now.

UseWebPImageDecoder(), UseWebPImageEncoder(), SaveImage(), LoadImage()

Nice Greetings
and thank you for the nice work in the last years :D[/b]

_________________
Still awaiting real brain interface for computers :-)
[ REGISTERED PB OWNER since years ] [Wind0ws + LINUX]


Top
 Profile  
Reply with quote  
 Post subject: Re: WebP Imageplugin
PostPosted: Thu Mar 12, 2020 7:28 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Sep 11, 2016 2:17 pm
Posts: 727
Seems that their (especially lossy) compression is worse than anything else quality wise.
I dont see any good reason why this would be a preferable or needed option.
Further the bad quality should not be a suprise since google uses a videocodec on still images!


Top
 Profile  
Reply with quote  
 Post subject: Re: WebP Imageplugin
PostPosted: Wed Aug 19, 2020 8:33 pm 
Offline
Addict
Addict

Joined: Wed Feb 28, 2007 9:13 am
Posts: 1054
Location: London
As the WebP format is now viewable on 80% of web browsers, it would seem like a format worth adding to PB.

_________________
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."


Top
 Profile  
Reply with quote  
 Post subject: Re: WebP Imageplugin
PostPosted: Tue Sep 15, 2020 9:32 am 
Offline
Addict
Addict

Joined: Thu Apr 18, 2019 8:17 am
Posts: 1006
+1, and for HEIF if possible because it's very common now for online images.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye