NO

Author Topic: GDI+ WebP support  (Read 9128 times)

Offline John Z

  • Member
  • *
  • Posts: 860
GDI+ WebP support
« on: February 26, 2023, 03:36:02 PM »
Over on the MASM site there was mention of GDI+ supporting WebP format 'soon'. This was back in Nov 2022.
http://masm32.com/board/index.php?topic=10437.msg114912#msg114912

Does it work for windows 10/11 now?  Guess I could just try but maybe someone knows already if
GDILoadPictureFile and GdipLoadImageFromFile work for WebP and maybe HEIF too.

There are 'work arounds' here https://forum.pellesc.de/index.php?topic=10593.0 but direct GDI+ would make it simple.

Thanks,
John Z

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 189
    • Bcx Basic to C/C++ Translator
Re: GDI+ WebP support
« Reply #1 on: February 26, 2023, 07:54:19 PM »
I discovered some apps (Most browsers, Media Player Classic, Paint 3D, others ) will display locally stored webp images.

I also discovered this repository:
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html

I downloaded the latest 64-bit version for Windows and unzipped.
Inside the /bin/ folder are several compiled apps ... notably,   dwebp

I converted a local webp image to a png on my first go:

C:\Temp>dwebp tree.webp  -o tree.png

So, if shelling out to dwebp doesn't send you screaming towards the door,
then you now have a simple way to give yourself access to webp images.
« Last Edit: February 26, 2023, 07:56:10 PM by MrBcx »
Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline John Z

  • Member
  • *
  • Posts: 860
Re: GDI+ WebP support
« Reply #2 on: February 26, 2023, 08:48:58 PM »
Thanks MrBcx,

I can easily use Ifranview for that both interactive and command line. 

vCardz_i supports a few image formats so I was thinking of updating it
to include WebP for photo and logo data. If GDI+ supports it then it is
just a matter of allowing the extension. Probably I just need to try it.

John Z

Offline Vortex

  • Member
  • *
  • Posts: 864
    • http://www.vortex.masmcode.com
Re: GDI+ WebP support
« Reply #3 on: February 26, 2023, 09:20:28 PM »
Hi John,

I tested Timo's example project on Win10PE, it works fine.
Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 860
Re: GDI+ WebP support
« Reply #4 on: February 27, 2023, 01:21:31 PM »
Hi John,

I tested Timo's example project on Win10PE, it works fine.

Thanks! I'm going to code it - that's all  :) :)

I'll post back success or fail

John Z

Update: Added WebP file handling but it fails to display.  GdipLoadImageFromFile does not load a WebP file.  Windows 11 2H22, OS build 22621.1265

GpStatus WINGDIPAPI GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image);

I'll wait ....
« Last Edit: February 27, 2023, 03:20:43 PM by John Z »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: GDI+ WebP support
« Reply #5 on: February 27, 2023, 05:21:42 PM »
I start thinking, that MS don't want to support Win32 API and  GDI+ any more.
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: GDI+ WebP support
« Reply #6 on: February 28, 2023, 10:18:57 AM »
It seems that this format is a Google proprietary format released under BSD license.
It has been developed, based on a video encoder format VP8, with the scope to reduce image size for the rilief of Google storage space and network traffic speedup.
It includes a loss and lossless algorithm, but the image quality is poor compared to native JPG or PNG, and limited in dimensions. Currently is under development a new version that is supposed to overcome the quality problem, but it appeared to not be an easy task and for this reason Google relocated the WebP2 project to a research environment:
Quote
"playground for image compression experiments".
The repository where are available sources and binaries is that reported by MrBCX.
Actually the format is handled by chromium browser and its derivatives, including MS Edge.
The format isn't supported in GDI+, but Google implemented a plugin for WIC (Windows Imaging Component) that integrated the format in the applications that use WIC as  Windows Photo Viewer, Microsoft Office 2010, FastPictureViewer.
Conclusion: this format is very useful for web pages to speed-up loading and reduce storage that will make it largely diffused in web apps, but is resource expansive (the encoding/decoding is CPU intensive), and poor in quality (actual standard). The last is a limit for high quality pictures.
Last, but not least, if a giant as Google push it, be sure that it will be a de-facto standard shortly....
For more info see.
« Last Edit: March 01, 2023, 10:12:25 AM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 189
    • Bcx Basic to C/C++ Translator
Re: GDI+ WebP support
« Reply #7 on: February 28, 2023, 04:36:15 PM »
From wiki:

On October 12, 2022, Google changed WebP 2's development repository's README file to state that "WebP 2 will not be released as an image format" and began describing WebP 2 as a "playground for image compression experiments".
Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: GDI+ WebP support
« Reply #8 on: March 01, 2023, 10:17:18 AM »
Conclusion: this format is very useful for web pages to speed-up loading and reduce storage that will make it largely diffused in web apps, but is resource expansive (the encoding/decoding is CPU intensive), and poor in quality (actual standard). The last is a limit for high quality pictures.
Last, but not least, if a giant as Google push it, be sure that it will be a de-facto standard shortly....
Considering that the encoding is made once, as a consequence, I was wondering, it will move energy consumption (CO2) from server side to user side...
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 189
    • Bcx Basic to C/C++ Translator
Re: GDI+ WebP support
« Reply #9 on: March 01, 2023, 03:51:49 PM »
Considering that the encoding is made once, as a consequence, I was wondering, it will move energy consumption (CO2) from server side to user side...

If Google generates a web page that contains gifs and jpegs, your computer uses energy to decompress and display those images.  Using a container like webp which requires more computing cycles will exacerbate energy usage on Google server (encode) and your PC (decode).  But that increase in energy usage MIGHT be offset on both ends by the reduction in data that would need to be sent between Google's server and your computer when using a container like webp. 

Determining whether the net energy usage is reduced, increased, or balanced is an exercise that I shall leave to the bean counters.
 
Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: GDI+ WebP support
« Reply #10 on: March 02, 2023, 10:25:02 AM »
If Google generates a web page that contains gifs and jpegs, your computer uses energy to decompress and display those images.  Using a container like webp which requires more computing cycles will exacerbate energy usage on Google server (encode) and your PC (decode).  But that increase in energy usage MIGHT be offset on both ends by the reduction in data that would need to be sent between Google's server and your computer when using a container like webp. 

Determining whether the net energy usage is reduced, increased, or balanced is an exercise that I shall leave to the bean counters.
Well the encoding, as I already said, is done once, then the encoded image is saved on the disk (storage reduction on servers). We can therefore completely neglect the energy to encode the image. Less energy is consumed by disk due to reduced dimensions, even more benefits will apply to backups in terms of energy, storage and work-time (less breakdowns, less repairs, less labor, reduced maintenance costs).
A huge quantity of energy is spared for data transmission along the whole internet with its servers, gateways, repeaters, medium translators, hubs, etc.
On the other hand trillions of computers will stress their CPU to decode the file.
Hard to make a balance, Google will get a lot of benefits per sure, what the repercussions on the world energy balance will be is to be analyzed.

almost for laughs: We take care to use low energy lamps and last generation low consumption home appliances, but don't regret to use 1kW power supplies to power last generation graphic-cards...  ;D
« Last Edit: March 02, 2023, 11:40:23 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 189
    • Bcx Basic to C/C++ Translator
Re: GDI+ WebP support
« Reply #11 on: March 03, 2023, 02:49:24 PM »
I agree with all of that Frankie. 

On a side note, one emerging technology to keep an eye on is sodium-ion battery development.
The abundance of sodium and significantly lower production costs could be revolutionary.


Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: GDI+ WebP support
« Reply #12 on: March 04, 2023, 11:51:10 AM »
On a side note, one emerging technology to keep an eye on is sodium-ion battery development.
The abundance of sodium and significantly lower production costs could be revolutionary.
That would be wonderful!  :D
Most geopolitical tensions related to soil richness would be defeated...  8)
I big pounch to lords of lithium (LOL  ;D )
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide