ImageEn, unit iexBitmaps

TIEBitmap.Resize

TIEBitmap.Resize


Declaration

procedure Resize(NewWidth, NewHeight: integer; BackgroundValue: double = 0; FillAlpha: integer = 255; HorizAlign: TIEHAlign = iehLeft; VertAlign: TIEVAlign = ievTop); overload
procedure Resize(AddLeft, AddTop, AddRight, AddBottom: integer; BackgroundValue: double = 0; FillAlpha: integer = 255); overload;


Description

Resize the image without resampling (i.e. the image content is not stretched).
This method also resizes the alpha channel.

Overload 1:
Parameter Description
NewWidth New image width
NewHeight New image height
BackgroundValue TColor value for ie24RGB images or a gray level for gray scale or black/white images. It is used to fill added regions
AlphaValue Alpha value used to fill added regions (0: Fully Transparent - 255: Opaque)
HorizAlign How to horizontally align the old image (has no effect unless the new width is greater than the old width)
VertAlign How to vertically align the old image (has no effect unless the new height is greater than the old height)

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)
BackgroundValue TColor value for ie24RGB images or a gray level for gray scale or black/white images. It is used to fill added regions
AlphaValue Alpha value used to fill added regions (0: Fully Transparent - 255: Opaque)


Examples

// resize image to 1000x1000
MyIEBitmap.Resize( 1000, 1000 );

// Crop 25% of outside of all edges
MyIEBitmap.Resize( MyIEBitmap.Width div 2, MyIEBitmap.Height div 2, 0, 0, iehCenter, ievCenter );

// Add a border around the image
MyIEBitmap.Resize( MyIEBitmap.Width + 80, MyIEBitmap.Height + 80, clBlack, 255, iehCenter, ievCenter );

// which is the same as:
MyIEBitmap.Resize( 80, 80, 80, 80, clBlack, 255 );

// Add 50 pixels to the top and bottom of the image, remove 80 pixels from the left and right
MyIEBitmap.Resize( -80, 50, -80, 50, 255 );