ImageEn, unit imageenproc

TImageEnProc.ImageResize

TImageEnProc.ImageResize


Declaration

procedure ImageResize(newWidth, newHeight: Integer; HorizAlign: TIEHAlign = iehLeft; VertAlign: TIEVAlign = ievTop; FillAlpha: Integer = 255; BackgroundColor: TColor = -1); overload;
procedure ImageResize(AddLeft, AddTop, AddRight, AddBottom: integer; FillAlpha: Integer; BackgroundColor: TColor = -1); overload;


Description

Resizes the current image. The content of the image doesn't change (no stretching).

Overload 1:
Parameter Description
NewWidth New image width
NewHeight New image height
HorizAlign Specifies how to horizontally align the old image
VertAlign Specifies how to vertically align the old image
FillAlpha Alpha value used to fill added regions (0: Fully Transparent - 255: Opaque)
BackgroundColor pecifies an alternative background color to fill new regions. If -1, Rotate uses the default background. If clNone, then the non-image area will become transparent

Overload 2:
Parameter Description
AddLeft Pixels to add to the left of the image (or remove if AddLeft < 0)
AddTop Pixels to add to the top of the image (or remove if AddTop < 0)
AddRight Pixels to add to the right of the image (or remove if AddRight < 0)
AddBottom Pixels to add to the bottom of the image (or remove if AddBottom < 0)
FillAlpha Alpha value used to fill added regions (0: Fully Transparent - 255: Opaque)
BackgroundColor pecifies an alternative background color to fill new regions. If -1, Rotate uses the default background. If clNone, then the non-image area will become transparent

Note:
The color of added background is specified by Background
A UI for this is available to your users in the Image Processing dialog


Demos

Demo  Demos\ImageEditing\Resize\Resize.dpr
Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// resize image to 1000x1000
ImageEnView1.Proc.ImageResize( 1000, 1000 );

// make a contour around the image
ImageEnView1.Proc.ImageResize( ImageEnView1.IEBitmap.Width + 80, ImageEnView1.IEBitmap.Height + 80, iehCenter, ievCenter );

// which is the same as:
ImageEnView1.Proc.Background := clBlack;
ImageEnView1.Proc.ImageResize( 80, 80, 80, 80, 255 );

// Add 50 pixels to the top and bottom of the image, remove 80 pixels from the left and right
ImageEnView1.Proc.ImageResize( -80, 50, -80, 50 );


// Add a black border to the image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );




ImageEnView1.Proc.ImageResize( ImageEnView1.IEBitmap.Width + 20,
                               ImageEnView1.IEBitmap.Height + 20,
                               iehCenter, ievCenter,
                               255, clBlack );