# 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: 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/imageflip.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.
