> 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/imageflip.md).

# ImageFlip

Flips or transposes an image along various axes.

## Syntax

```
ImageFlip( name, transpose )
```

Or as a member:

```
someImage.flip( transpose )
```

## Arguments

| Name      | Type   | Required | Description                                                             |
| --------- | ------ | -------- | ----------------------------------------------------------------------- |
| name      | any    | Yes      | The image or the name of a variable referencing an image to operate on. |
| transpose | string | Yes      | The type of flip or transpose operation. Valid values: See below.       |

## Returns

**BoxImage**: The modified BoxImage instance after the flip or transpose operation.

## Description

`ImageFlip` flips or transposes the specified image according to the given operation. This function supports both simple flips (mirror operations) and more complex transpose operations including rotations.

### Valid Transpose Values

* `horizontal` - Flip the image horizontally (mirror left/right)
* `vertical` - Flip the image vertically (mirror top/bottom)
* `diagonal` - Transpose along the main diagonal (top-left to bottom-right)
* `antidiagonal` - Transpose along the anti-diagonal (top-right to bottom-left)
* `90` - Rotate 90 degrees clockwise
* `180` - Rotate 180 degrees
* `270` - Rotate 270 degrees clockwise (same as 90 degrees counter-clockwise)

## Example

```boxlang
// Flip an image horizontally (mirror)
img = ImageFlip( myImage, "horizontal" );

// Flip vertically
img = ImageFlip( myImage, "vertical" );

// Rotate 90 degrees clockwise
img = ImageFlip( myImage, "90" );

// Transpose along diagonal
img = ImageFlip( myImage, "diagonal" );

// As a member function (chainable)
myImage.flip("horizontal")
       .flip("vertical");  // Results in 180-degree rotation
```

## Use Cases

* **horizontal**: Create mirror images for design purposes
* **vertical**: Flip images upside down
* **90, 180, 270**: Rotate images without quality loss
* **diagonal/antidiagonal**: Advanced image transformations for effects

## Related BIFs

* ImageRotate
* ImageCrop
* ImageResize

## Notes

* All arguments are required.
* The image can be passed as a BoxImage object or as a variable name referencing an image.
* The operation modifies the image in place when used as a member function.
* Returns the modified image object for chaining or further processing.
* Invalid transpose values will throw a validation error.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
