Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxCustomSmartImage.Resize(TSize) Method

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

#Declaration

Delphi
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.

#Code Example: Load and Downscale an Image

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