function CropTransparentPixels: TRect;
Trim transparent edges until each edge contains at least one opaque or semi-opaque pixel.
This function returns the bounds of the cropped region (before the image is resized).
uses Img32, Img32.Fmt.PNG;
...
img := TImage32.Create;
img.LoadFromFile('star.png');
img.CropTransparentPixels;
//HatchBackground
img.SaveToFile('star_cropped.png');
img.Free;
After:
Copyright ©2010-2023 Angus Johnson - Image32 4.8 - Help file built on 16 Apr 2025