A.M. Hoornweg 144 Posted January 4, 2022 Hello all, I have a tImagecollection with square transparent PNG images at 256x256 size which I want to downscale smoothly. The collection's interpolation mode is set to icIMModeHighQualityCubic. I notice that tVirtualImage gives much smoother image quality at 32x32 than tImage if I manually downscale the image using tImageCollection.GetBitmap(). I would very much like to get to the bottom of this. This is the code I use to manually extract and downscale an image from tImagecollection. Parameter "Targetimage" is just a TImage on some TPanel on a TForm. Am I doing something wrong? procedure LoadImageFromCollection(TargetImage: tImage; ImageName: string; Collection: TImageCollection; DesiredHeight: Integer); var tb: tbitmap; h,idx: Integer; begin idx := Collection.GetIndexByName(ImageName); if idx > -1 then begin h:=desiredHeight; if TargetImage.AlignWithMargins then h := h - TargetImage.Margins.Top - TargetImage.Margins.Bottom; TargetImage.Height := h; TargetImage.width := h; TargetImage.Transparent := True; tb := Collection.getbitmap(idx, h, h); try tb.AlphaFormat := afDefined; TargetImage.Picture.Bitmap.Assign(tb); finally tb.free; end; end; end; Share this post Link to post
angusj 126 Posted January 4, 2022 53 minutes ago, A.M. Hoornweg said: TargetImage.Transparent := True; Delete this line. It's only (sort of) useful for images without alpha transparency. 1 Share this post Link to post
A.M. Hoornweg 144 Posted January 4, 2022 5 minutes ago, angusj said: Delete this line. It's only (sort of) useful for images without alpha transparency. Thank you! Now it works ! Share this post Link to post