Recent

Author Topic: WEBP, no DLLs  (Read 1421 times)

Tomxe

  • Full Member
  • ***
  • Posts: 107
WEBP, no DLLs
« on: May 28, 2026, 07:22:14 am »
https://github.com/Xelitan/Pure-Pascal-Webp-for-Delphi-Lazarus-Free-Pascal/

No encoding for now, sorry.

Add WebpImageX to your uses, then:

Code: Pascal  [Select][+][-]
  1. Image1.Picture.LoadFromFile('test.webp');

AlexTP

  • Hero Member
  • *****
  • Posts: 2715
    • UVviewsoft
Re: WEBP, no DLLs
« Reply #1 on: May 28, 2026, 10:29:53 pm »
Thanks, it is useful, I asked for it in github and later I closed my request because some Pascal lib for WebP already exists. AI told me about it.

Tomxe

  • Full Member
  • ***
  • Posts: 107
Re: WEBP, no DLLs
« Reply #2 on: May 29, 2026, 05:07:08 am »
There are a few Pascal libs for Webp but they require DLLs

AlexTP

  • Hero Member
  • *****
  • Posts: 2715
    • UVviewsoft
Re: WEBP, no DLLs
« Reply #3 on: May 29, 2026, 08:16:05 am »
webpimageX.pas says:
> Target:   Win64, Free Pascal, Delphi       

Is it only Win64, or also other OS / bitness?
« Last Edit: May 29, 2026, 08:53:55 am by AlexTP »

Tomxe

  • Full Member
  • ***
  • Posts: 107
Re: WEBP, no DLLs
« Reply #4 on: May 29, 2026, 10:25:49 am »
Should work on other OSes and on 32 bit, but it wasn't tested.

CM630

  • Hero Member
  • *****
  • Posts: 1701
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: WEBP, no DLLs
« Reply #5 on: May 29, 2026, 12:25:03 pm »
This is how it look like in Linux Mint mate in a VM:
In KUbuntu it looks the same.
« Last Edit: May 29, 2026, 01:09:17 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

Tomxe

  • Full Member
  • ***
  • Posts: 107
Re: WEBP, no DLLs
« Reply #6 on: May 30, 2026, 08:56:13 am »
This is how it look like in Linux Mint mate in a VM:
In KUbuntu it looks the same.

I added a switch to support Linux. Can you test?
« Last Edit: May 30, 2026, 10:57:57 am by Tomxe »

Thaddy

  • Hero Member
  • *****
  • Posts: 19273
  • Glad to be alive.
Re: WEBP, no DLLs
« Reply #7 on: May 31, 2026, 02:37:30 pm »
Your decoder outputs BGRA but your Linux widget interprets it as RGBA. BGRA is correct.
objects are fine constructs. You can even initialize them with constructors.

CM630

  • Hero Member
  • *****
  • Posts: 1701
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: WEBP, no DLLs
« Reply #8 on: May 31, 2026, 07:07:07 pm »
...I added a switch to support Linux. Can you test?...
Linux Mint Mate on real and virtual HW, see the screenshot.

Also, I had to edit in WebpImageX.pas:

uses ...
     WebpDec,


to

uses ...
     WebPDec,
« Last Edit: June 01, 2026, 02:55:52 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

Thaddy

  • Hero Member
  • *****
  • Posts: 19273
  • Glad to be alive.
Re: WEBP, no DLLs
« Reply #9 on: June 02, 2026, 03:19:05 pm »
read my reply: on linux the deciding is wrong color order. That is all and needs fixing at the widget side.
Your decoder outputs BGRA but your Linux widget interprets it as RGBA. BGRA is correct.
Not a joke: the decoding is otherwise OK. He did a straight, correct, translation but the issue is Lazarus/Linux.

The correct order is taken from the image itself. That's why everybody else shows it ok, just not Lazarus/Linux. Any other main software recognizes the encoding correct on all platforms.

Just file a bug report. This is not his fault. On Windows it is fine, because it respects the specified order..
« Last Edit: June 02, 2026, 03:47:08 pm by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

dsiders

  • Hero Member
  • *****
  • Posts: 1635
Re: WEBP, no DLLs
« Reply #10 on: June 02, 2026, 10:02:11 pm »
Just file a bug report. This is not his fault. On Windows it is fine, because it respects the specified order..

Actually, it's a feature request... since WebP is not one of the image formats supported in LCL/TImage.

Thaddy

  • Hero Member
  • *****
  • Posts: 19273
  • Glad to be alive.
Re: WEBP, no DLLs
« Reply #11 on: June 03, 2026, 10:23:20 am »
Fine with me. I just debugged it (and was "easy", but not for an hour of looking...)
BTW: the FPC decoding itself - also on Linux - is fine, the display error appears only higher up in the chain at the display level, so that is to me a bug...and not a feature. Otherwise Windows display would also fail.
I can't spend more time on it, but you can use that - I am sure it is correct - conclusion.
« Last Edit: June 03, 2026, 10:29:30 am by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2706
Re: WEBP, no DLLs
« Reply #12 on: June 03, 2026, 10:26:26 am »
Just file a bug report. This is not his fault. On Windows it is fine, because it respects the specified order..

Actually, it's a feature request... since WebP is not one of the image formats supported in LCL/TImage.

Not really IMO. When using a "3rd party" decoder, a TImage should be able to display the data. However the decoded color bytes should be provided in the correct order. You can use TRawImage & co  to feed this to TImage.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Tomxe

  • Full Member
  • ***
  • Posts: 107
Re: WEBP, no DLLs
« Reply #13 on: June 03, 2026, 10:57:15 am »
There are thousands of programs written for Delphi that use Scanline. FPC/Lazarus tries to emulate Delphi. So I believe there should be an easy way to use Scanline for all platforms just like on Windows.
There could be a function TBitmap.FixScanlines that converts from Windows to whatever platform.

Anyway, I will try to make Webp work on other platforms.

Thaddy

  • Hero Member
  • *****
  • Posts: 19273
  • Glad to be alive.
Re: WEBP, no DLLs
« Reply #14 on: June 03, 2026, 11:09:59 am »
scanline is not the issue. the order that the emulation of scanline under Linux does IS the issue.
I would not spend time on that since YOUR code is correct. Unless you want to debug scanline on linux.... :D
objects are fine constructs. You can even initialize them with constructors.

 

TinyPortal © 2005-2018