CImage:Scale


The Scale method scales the image by a factor relative to 1.0.

Syntax

bSuccess = CImage:Scale( nScale )

bSuccess = CImage:Scale( nScale, bResize )

where

    nScale is the multiplication factor and may be a number or string.

    bResize controls whether the image dimension is adjusted for the scale factor. It defaults to true.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

The optional bResize controls whether the image shape is changed to accommodate the rotation of a non-square image.

This method resamples the image to calculate the new values at fractional pixel locations. Resampling is controlled by members of the ResampleParams table. The image is not resampled if both x and y shifts are integral values. When resampling is needed, you can either do nothing and use the default parameters or set specific parameters and then call SetResampleParams function.

Example

Suppose an image is displayed in a CImageView named V. The following script scales the image by 1.2 times without changing the number of image pixels:

I = V:GetImage()

-- attach the current displayed image

I:Scale( 1.2, false )

-- perform the operation, do not change image size

V:Update()

-- update the display after the scale

Related Topics

ScaleXy

Image Geometry Mtethods

CImage class