when i convert PNG picture to BMP picture via routine below, then colors are not same in BMP as they are in original PNG.
<code>procedure TForm1.Button4Click(Sender: TObject);
var
R: TRect;
Bmp: TBitmap;
Png: TPngImage;
begin
Png := TPngImage.Create;
try
Png.LoadFromFile('C:tempSource.png');
bmp := TBitmap.Create(Png.Width, Png.Height);
try
R := Rect(0, 0, Png.Width, Png.Height);
bmp.Canvas.CopyRect(R, png.Canvas, R);
bmp.SaveToFile('C:temptarget.bmp')
finally
Bmp.Free;
end;
finally
Png.Free;
end;
end;
</code>
<code>procedure TForm1.Button4Click(Sender: TObject);
var
R: TRect;
Bmp: TBitmap;
Png: TPngImage;
begin
Png := TPngImage.Create;
try
Png.LoadFromFile('C:tempSource.png');
bmp := TBitmap.Create(Png.Width, Png.Height);
try
R := Rect(0, 0, Png.Width, Png.Height);
bmp.Canvas.CopyRect(R, png.Canvas, R);
bmp.SaveToFile('C:temptarget.bmp')
finally
Bmp.Free;
end;
finally
Png.Free;
end;
end;
</code>
procedure TForm1.Button4Click(Sender: TObject);
var
R: TRect;
Bmp: TBitmap;
Png: TPngImage;
begin
Png := TPngImage.Create;
try
Png.LoadFromFile('C:tempSource.png');
bmp := TBitmap.Create(Png.Width, Png.Height);
try
R := Rect(0, 0, Png.Width, Png.Height);
bmp.Canvas.CopyRect(R, png.Canvas, R);
bmp.SaveToFile('C:temptarget.bmp')
finally
Bmp.Free;
end;
finally
Png.Free;
end;
end;
Could you provide me a hint how to solve this issue please.
Thank you
JP