ImageEn, unit imageenproc |
|
TImageEnProc.CropTransparentBorder
Declaration
procedure CropTransparentBorder;
Description
Removes any transparent area on the edge of the image, resizing the resulting image to the visible rectangle.
Example
// Add text to a layer and then remove the transparent area around the text
// add a new layer
ImageEnView1.LayersAdd;
// White fill the new layer
ImageEnView1.Proc.Fill(CreateRGB(255, 255, 255));
// Output our text
ImageEnView1.Proc.TextOut(Align_Text_Horz_Center, Align_Text_Near_Bottom, ExtractFileName(ImageEnView1.IO.Params.Filename), 'Arial', 32, clRed, [fsBold]);
// Make the white background transparent
ImageEnView1.Proc.SetTransparentColors(CreateRGB(255, 255, 255), CreateRGB(255, 255, 255), 0); // remove the white, making it as transparent
// Crop to the text size
ImageEnView1.Proc.CropTransparentBorder;
See Also