Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi 32 Bit Bitmap in PNG umwandeln (https://www.delphipraxis.net/108491-32-bit-bitmap-png-umwandeln.html)

Martin K 14. Feb 2008 16:59


32 Bit Bitmap in PNG umwandeln
 
Hallo,

wie kann ich ein 32 Bit Bitmap in eine PNG umwandeln?
Für PNGs verwende ich normalerweise TPNGGraphic aus der Unit GraphicEx, doch PNGs zu speichern scheint damit wohl nicht so ganz zu gehen, es kommt immer ein Bitmap dabei raus?!?

P.S.: Ich hab's selber nicht geglaubt, aber über die Forums-Suche habe ich nichts zum Unwandeln BMP -> PNG gefunden oder ich habe irgendwas übersehen...

Dani 14. Feb 2008 17:43

Re: 32 Bit Bitmap in PNG umwandeln
 
TPNGGraphic aus GraphicEx kann PNGs nur laden, nicht speichern. Es gibt auch eine Unit "PngImage" [Klasse TPNGObject], die PNGs speichern kann: http://pngdelphi.sourceforge.net

Martin K 14. Feb 2008 18:38

Re: 32 Bit Bitmap in PNG umwandeln
 
OK, danke.
Funktioniert soweit.

Den Alpha-Kanal kann ich aber nur mit AlphaScanline bearbeiten, nicht mit dem höchstwertigen Byte von Scanline?
Irgendwie ist das mit Scanline etwas umständlich, weil man hier immer nur die 3 Bytes hat, wenn man ein PIntegerArray nimmt hat man da als höchstwertiges Byte schon das vom nächsten Pixel, irgendwie etwas umständlich...
Also bei TBitmap.Scanline war das irgendwie anders und einfacher, da ging das einfach mit einem PIntegerArray.
Liege ich da richtig?

Edit: Was für ein Array kann man sonst für Scanline dann nehmen, es gibt ja keinen 3 Byte großen Zahlen-Datentyp?!?

Namenloser 14. Feb 2008 18:50

Re: 32 Bit Bitmap in PNG umwandeln
 
Probier's mal mit nem record:
Delphi-Quellcode:
tRGBTriple = packed record
  r,g,b: byte;
end;
pRGBTriple = ^TRGBTriple;

Martin K 14. Feb 2008 19:05

Re: 32 Bit Bitmap in PNG umwandeln
 
Danke, habe in der Unit pngimage noch den Typ pRGBLine gefunden, der macht genau das ;)

Edit:
Delphi-Quellcode:
  TRGBLine = array[word] of TRGBTriple;
  pRGBLine = ^TRGBLine;
TRGBTriple ist übrigens schon in der Windows-Unit deklariert.


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:57 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz