Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I display a WebP image in a TImage or just TBitmap? [closed]

Tags:

delphi

webp

Delphi-WebP is a project providing Delphi bindings for Google's libWebP.dll, which loads WebP images, but the project provides no Delphi-specific image code.
How can I load a WebP image into a TImage or TBitmap?

like image 248
Prog1020 Avatar asked Oct 04 '22 03:10

Prog1020


1 Answers

You should develop and register TGraphic sub-class, that can load/save WebP format images, just like TPNGImage, TJPEGImage and TGIFImage classes work.

You can get examples of such classes in recent versions of VCL (JPEG and PNG), on Torry.net or with libraries like:

  • http://melander.dk/delphi/gifimage/
  • http://www.soft-gems.net/index.php/libs/graphicex-library
  • http://galfar.vevb.net/imaging/doc/html/faq.html

Just learn how that was implemented in there projects and do the same for your project of WebP support.

PS. You can also derive your class from TBitmap rather than TGraphic - that would be less effective but simplier to do. For example of this approach see http://galfar.vevb.net/wp/projects/jpeg2000-for-pascal/ However that would loose all the WebP-specific information and would be "quick and dirty" hack rather than proper VCL-targeted implementation.

like image 131
Arioch 'The Avatar answered Oct 13 '22 07:10

Arioch 'The