Problem to save image (in PNG) with transparency;
I do not know how to do it, I tried this (but have not had the expected result):
procedure TForm1.Button1Click(Sender: TObject);
var png: TPortableNetworkGraphic;
begin
png:=TPortableNetworkGraphic.Create;
png.Width:=200;
png.Height:=200;
png.Transparent:=true;
png.TransparentColor:=clYellow; // transparent color
png.Canvas.Brush.Color:=clblue;
png.Canvas.FillRect(0,0,199,199);
png.Canvas.Brush.Color:=clyellow;
png.Canvas.FillRect(50,50,150,150);
png.SaveToFile('image.png'); // why the image has no transparency?
end;
How to save the image in PNG with transparency?, Is it possible?, What is the solution?
Thanks.