I'm trying do save dynamically created bitmaps in png format with Transparency set on but with no good result.
Here is a snippet of my test code in which the problem may be probably seen.
I read the bitmap from the test file, and save it to be sure it is 32 bit with transparency set.
Then I read it into TIEBitmap object.
And here I get the PixelFormat of the IEBitmap object value ie24RGB not ie32RGB which I expect.
procedure TForm1.open_saveClick(Sender: TObject);
var bmp: TBitmap;
iebmp: TIEBitmap;
fn: string;
begin
if odp.Execute() then
begin
fn := odp.FileName;
bmp := tBitmap.Create;
bmp.TransparentMode := tmAuto;
bmp.Transparent := true;
bmp.LoadFromFile(fn);
bmp.SaveToFile(fn); // I save bmp with pf32bit
iebmp := TIEBitmap.Create();
iebmp.ParamsEnabled := True;
iebmp.Params.BMP_HandleTransparency := True; // Alpha Channel will be saved (as a 32bit RGBA BMP)
iebmp.Read(fn); // iebmp.Pixelformat = ie24RGB
iebmp.Write(StringReplace(fn,'.bmp','.png',[rfReplaceAll]));
iebmp.Free;
bmp.Free;
end;
end;
May be the bitmap should be prepared in some different way, but don't know how to do it.
Kowalski