Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

GMImage.Affine

Applies an affine transformation.

Component Version macOS Windows Linux Server iOS SDK
GraphicsMagick 4.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "GMImage.Affine"; ImageRef { ; sx; sy; rx; ry; tx; ty } )   More

Parameters

Parameter Description Example Flags
ImageRef The image reference number. 1
sx The x scale factors.
Default is 1.
1 Optional
sy The y scale factors.
Default is 1.
1 Optional
rx The x rotate factors. 0 Optional
ry The y rotate factors. 0 Optional
tx The x translation value. 0 Optional
ty The y translation value. 0 Optional

Result

Returns OK or error.

Description

Applies an affine transformation.
Specify a transformation matrix to adjust scaling, rotation, and translation (coordinate transformation) for subsequently drawn objects in the same or decendent drawing context. The sx & sy parameters represent the x & y scale factors, the rx & ry parameters represent the x & y rotation, and the tx & ty parameters represent the x & y translation:

Examples

Make the image double the width:

Set Variable [ $r ; Value: MBS( "GMImage.AffineTransform"; $Image; 2; 1; 0; 0; 0; 0 ) ]

Make the image double the height:

Set Variable [ $r ; Value: MBS( "GMImage.AffineTransform"; $Image; 1; 2; 0; 0; 0; 0 ) ]

Rotate 10 degree:

Set Variable [ $r ; Value: MBS( "GMImage.AffineTransform"; $Image; 1; 1; 10/180*Pi; -10/180*Pi; 0; 0 ) ]

Move 100 points to left:

Set Variable [ $r ; Value: MBS( "GMImage.AffineTransform"; $Image; 1; 1; 0; 0; 100; 0 ) ]

See also

Release notes

This function checks for a license.

Created 18th August 2014, last changed 30th March 2026


GMImage.AddPathSmoothQuadraticCurvetoRel - GMImage.AffineTransform