CImage:Affine


The Affine method applies an affine transformation of shift, scale, and rotation to the image.

Syntax

bResult = CImage:Affine( nX, nY, nAngle, nScale, bResize=false )

bullet.gif    nX and nY specify the shifts, in pixel units.

bullet.gif    nAngle is the rotation angle, in degrees.

bullet.gif    nScale is the magnification relative to 1.0.

bullet.gif    bResize is optional and controls whether the image is expanded to hold the scaled image.

bullet.gif    On success, true is returned, otherwise false is returned.

Remarks

The affine transformation shifts the image center, then applies the rotation and the scale factor.

Example

The following script shifts the image 10 pixels in x and 20.52 in y, rotates -30.25 degrees, and scales by 1.2 times:

 

I = new_image()

-- create a new CImage

nX = 10 ; nY = 20.52

-- shifts

A = -30.25 ; M = 1.2

-- angle and magnification

I:Affine( nX, nY, A, M )

-- perform the operation on image I

Related Topics

CImage class, SetResampleParams


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.