Recent

Author Topic: [AGGPas, fpGUI] Use CopyImage method  (Read 917 times)

Roland57

  • Hero Member
  • *****
  • Posts: 602
    • msegui.net
[AGGPas, fpGUI] Use CopyImage method
« on: February 24, 2026, 04:37:54 pm »
Hello everybody.

I would like to use a static background (a PNG image) for my clock. I use CopyImage method of TAgg2D, and TFpgImage.

It works, but the colors are not as expected. (Compare the pictures attached.)

Would you see what is wrong in my code?

Regards.

Roland
« Last Edit: February 24, 2026, 04:39:25 pm by Roland57 »
My projects are on Codeberg.

dergen

  • New Member
  • *
  • Posts: 10
Re: [AGGPas, fpGUI] Use CopyImage method
« Reply #1 on: February 27, 2026, 09:33:46 am »
Check RGBA <> BGRA or Transparent copying bug.

Graeme

  • Hero Member
  • *****
  • Posts: 1518
    • Graeme on the web
Re: [AGGPas, fpGUI] Use CopyImage method
« Reply #2 on: March 17, 2026, 12:37:36 pm »
Just so others benefit from the answer, I've explained it in the link below. The static.png image is a PNG with 16-bit colour channels - something not used often. 99.99% of images normally use 8-bit colour channels. fpGUI doesn't officially support reading and displaying 16-bit colour channel images, as there simply hasn't been a need for it. Convert it to 8-bit channels using something like The GIMP and then it renders fine.

https://github.com/graemeg/fpGUI/issues/164#issuecomment-4074196192
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Roland57

  • Hero Member
  • *****
  • Posts: 602
    • msegui.net
Re: [AGGPas, fpGUI] Use CopyImage method
« Reply #3 on: March 18, 2026, 06:04:55 am »
Thank you Graeme. Glad that my program is fixed.

For information, here is how I converted the image with ImageMagick:

$ file static.png
static.png: PNG image data, 400 x 400, 16-bit/color RGBA, non-interlaced
$ magick static.png PNG32:static2.png
$ file static2.png
static2.png: PNG image data, 400 x 400, 8-bit/color RGBA, non-interlaced


But later I found I could create directly 8-bit/color image:
Code: Pascal  [Select][+][-]
  1.   png := TFPWriterPNG.Create;
  2.   png.WordSized := FALSE;
My projects are on Codeberg.

 

TinyPortal © 2005-2018