var
PNG : TPNGObject;
AlphaBMP : TBitmap;
Scanline : pByteArray;
x,y : Integer;
begin
PNG:=TPNGObject.Create;
PNG.LoadFromFile('
E:\Icons\PNGIcons\nuvola\64x64\filesystems\link.png');
png.Draw(Image1.Canvas,Rect(0,0,Png.Width,png.Height));
AlphaBMP:=TBitmap.Create;
AlphaBMP.Width:=png.Width;
AlphaBMP.Height:=png.Height;
AlphaBMP.PixelFormat:=pf8bit;
for y:=0
to png.Height-1
do
begin
Scanline:=png.AlphaScanline[y];
for x:=0
to png.Width-1
do
AlphaBMP.Canvas.Pixels[x,y]:=
RGB(Scanline^[x],Scanline^[x],Scanline^[x]);
end;
PaintBox1.Canvas.Draw(0,0,AlphaBMP);
AlphaBMP.SaveToFile('
c:\test.bmp');
AlphaBMP.Free;
png.Free;
end;