I have a TBitmap that contains a translucent image with an alpha channel (in this example, I got it from TPngImage).
var SourceBitmap: TBitmap; PngImage: TPngImage; begin PngImage := TPngImage.Create(); SourceBitmap := TBitmap.Create(); try PngImage.LoadFromFile('ImgSmallTransparent.png'); SourceBitmap.Assign(PngImage); SourceBitmap.SaveToFile('TestIn.bmp'); imgSource.Picture.Assign(SourceBitmap); finally PngImage.Free(); SourceBitmap.Free(); end;
When I save this TBitmap in the TestIn.bmp file and open it using any image viewer, I see transparency. But when I assign it to TImage, the transparent pixels appear black (TImage has Transparent = True ).
How to display TBitmap with transparency on TImage?
delphi gdi timage
Andrew
source share