GMImage.TransformRotation
-------------------------

Rotation to use when annotating with text or drawing.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [GraphicsMagick](component_GraphicsMagick.md) | [2.0](newinversion20.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "GMImage.TransformRotation"; ImageRef; angle ) 

**MBS**( **"GMImage.TransformRotation";** /\* Rotation to use when annotating with text or drawing. \*/  
**$ImageRef**; /\* The image reference number.e.g. 1 \*/   
**$angle**) /\* The angle.e.g. 90 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |
| angle | The angle. | 90 |

### Result

Returns "OK" on success.

### Description

Rotation to use when annotating with text or drawing.  
If you need to rotate the image, please use [GMImage.Rotate](GMImageRotate.md) function.  
  
See [GMImage.TransformReset](GMImageTransformReset.md) to reset current transform.  
### Examples

Draw rectangle 45° rotated at specific coordinate:

 # move origin   
Set Variable \[ $r ; Value: MBS ( "[GMImage.TransformOrigin](GMImageTransformOrigin.md)"; $img ; 50 + 125; 50 + 75 ) \]   
\# draw rectangle centered there   
Set Variable \[ $r ; Value: MBS ("[GMImage.DrawRectangle](GMImageDrawRectangle.md)"; $img ; -125; -75; 125; 75) // 250 x 150 \]   
\# rotate 45°   
Set Variable \[ $r ; Value: MBS ( "GMImage.TransformRotation"; $img ; 45 ) \]   
\# draw rectangle centered there   
Set Variable \[ $r ; Value: MBS ("[GMImage.DrawRectangle](GMImageDrawRectangle.md)"; $img ; -125; -75; 125; 75) // 250 x 150 \]  
### See also

- [GMImage.DrawRectangle](GMImageDrawRectangle.md)
- [GMImage.Rotate](GMImageRotate.md)
- [GMImage.Transform](GMImageTransform.md)
- [GMImage.TransformOrigin](GMImageTransformOrigin.md)
- [GMImage.TransformReset](GMImageTransformReset.md)

This function checks for a license.

Created 18th August 2014 , last changed 16th December 2020

  
[GMImage.TransformReset](GMImageTransformReset.md) - [GMImage.TransformScale](GMImageTransformScale.md)

[HTML Version](GMImageTransformRotation.shtml)