Skip to main content

TdxCustomSmartImage.Resize(TSize) Method

Resizes the stored image according to the new specified dimensions, in pixels.

Declaration

procedure Resize(const ASize: TSize); overload;

Parameters

Name Type Description
ASize TSize

The new image dimensions, 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 example downscales the stored image to two-thirds of its original dimensions:

var
  AImage: TdxSmartImage;
  dxOpenPictureDialog1: TdxOpenPictureDialog;
  //...
  dxOpenPictureDialog1.Execute(Handle);
  if(dxOpenPictureDialog1.FileName = '') then Exit;
  AImage := TdxSmartImage.Create;
  AImage.LoadFromFile(dxOpenPictureDialog1.FileName);
  AImage.Resize(Size(640, 480));
  // ...
See Also