Recent

Author Topic: libwebp - read/write of WebP images  (Read 785 times)

LacaK

  • Hero Member
  • *****
  • Posts: 691
libwebp - read/write of WebP images
« on: April 01, 2022, 08:57:50 am »
I have written pascal headers around Google's libwebp library plus implementation of reader and writter plus implementation of TWEBPImage class.
libwebp.dll is required (pre-compiled x86 and x64 versions are part of ZIP)

http://lacak.users.sourceforge.net/freepascal.html#libwebp

  • libwebp.pas    :
              Pascal headers to Google's library "libwebp.dll" (requires "libwebp.dll")
                       https://developers.google.com/speed/webp/docs/api
                       https://developers.google.com/speed/webp/download
  • fpreadwebp.pas :
              implements TFPReaderWEBP (descendant of TFPCustomImageReader, requires "libwebp.pas")
              implements TFPWriterWEBP (descendant of TFPCustomImageWriter, requires "libwebp.pas")
  • webpimage.pas  :
              implements TWEBPImage (descendant of TFPImageBitmap, requires "fpreadwebp.pas")

(Note: decoding of WebP data is done in two hops. First image data (provided from input stream) are decoded into RGBA buffer (whole image) and then all pixels are again supplied to TFPCustomImage.Colors. It is not optimal from my POV, but problem is that TFPCustomImage (as generic ancestor) does not provide any direct access to underlaying BGRA pixels. So if anyone has idea how to improve it please give feedback here)
« Last Edit: April 01, 2022, 12:01:44 pm by LacaK »

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: libwebp - read/write of WebP images
« Reply #1 on: April 01, 2022, 10:22:48 am »
Good!
BTW, cross-platform WEBP support is in the BGRABitmap.

 

TinyPortal © 2005-2018