> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-framework/modularity/image-manipulation/reference/built-in-functions/imagerotate.md).

# ImageRotate

## Syntax

```
ImageRotate( name, angle )
```

Or via the `BoxImage` fluent API:

```
someImage.rotate( angle )
```

## Arguments

| Name  | Type    | Required | Description                                                    |
| ----- | ------- | -------- | -------------------------------------------------------------- |
| name  | any     | Yes      | The image to rotate. Can be a `BoxImage` object or image name. |
| angle | numeric | Yes      | The angle (in degrees) to rotate the image.                    |

## Returns

`BoxImage` — The rotated image object.

## Description

Rotates an image by the specified angle (in degrees). Positive values rotate clockwise, negative values rotate counterclockwise. Useful for correcting orientation or creating rotated graphics.

## Example

```boxlang
// Rotate image 90 degrees clockwise
result = ImageRotate( myImage, 90 );

// Rotate image 45 degrees counterclockwise
result = ImageRotate( myImage, -45 );

// As a fluent method on BoxImage
myImage.rotate( 180 );
```

## Related BIFs

* ImageResize
* ImageFlip
* ImageCrop

## Notes

* The `name` argument can be a `BoxImage` object or the name of an image variable in the current context.
* The operation modifies the image in place.
* Returns the modified image object for chaining or further processing.
* Only the `angle` argument is supported; x and y arguments are not implemented.
* Positive angles rotate clockwise, negative angles rotate counterclockwise.
* The image dimensions may change after rotation (except for 90° increments).
* For simple 90°, 180°, 270° rotations, consider using `ImageFlip()` with transpose values.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-framework/modularity/image-manipulation/reference/built-in-functions/imagerotate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
