TdxCustomSmartImage.Resize(Integer,Integer) Method
Resizes the stored image according to the new specified dimensions, in pixels.
Declaration
procedure Resize(const AWidth: Integer; const AHeight: Integer); overload; virtual;
Parameters
Name | Type | Description |
---|---|---|
AWidth | Integer | The new image width, in pixels. |
AHeight | Integer | The new image height, in pixels. |
Remarks
Call the Resize
procedure to upscale or downscale the stored image to any specified dimensions. If you wish to resize the image while keeping its aspect ratio, call the Scale procedure instead.
Note
If the stored image is in any supported raster format, the Resize
procedure converts the image into the BMP format and discards the original image metadata. You can use the ImageCodec property to convert the stored image to the original format.
You can scale SVG images without changing their format.
Example
The following code sets the dimensions of the stored image to 640
by 480
pixels:
var
AImage: TdxSmartImage;
dxOpenPictureDialog1: TdxOpenPictureDialog;
//...
dxOpenPictureDialog1.Execute(Handle);
if(dxOpenPictureDialog1.FileName = '') then Exit;
AImage := TdxSmartImage.Create;
AImage.LoadFromFile(dxOpenPictureDialog1.FileName);
AImage.Resize(640, 480);
See Also