ImageEn, unit imageenproc

TImageEnProc.CropTransparentBorder

TImageEnProc.CropTransparentBorder


Declaration

function CropTransparentBorder(): TRect;


Description

Remove any transparent area from the edge of the image, resizing the resulting image to the visible rectangle.
Result is the area that the image was cropped to (or the full image if no cropping occured).

Note: For layers, use CropAlpha


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );



// Remove any transparent area from the edge of the image
ImageEnView1.Proc.CropTransparentBorder();




// 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

AutoCrop
AutoCrop2
Crop
CropAlpha
CropAlpha
LayersFixBorders