ImageEn, unit imageenproc

TImageEnProc.CropTransparentBorder

TImageEnProc.CropTransparentBorder


Declaration

procedure CropTransparentBorder();


Description

Remove any transparent area from the edge of the image, resizing the resulting image to the visible rectangle.


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

Public Method  AutoCrop
Public Method  AutoCrop2
Public Method  Crop
Public Method  TIEBitmap.CropAlpha