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

# ImageAddBorder

Adds a border to an image. This BIF allows you to specify the thickness, color, and type of border to apply to an image in BoxLang.

## Syntax

```
ImageAddBorder(name, thickness [, color] [, borderType])
```

## Arguments

| Name       | Type    | Required | Default | Description                                                             |
| ---------- | ------- | -------- | ------- | ----------------------------------------------------------------------- |
| name       | any     | Yes      |         | The image or the name of a variable referencing an image to operate on. |
| thickness  | numeric | Yes      |         | Border thickness (in pixels).                                           |
| color      | string  | No       | "black" | Border color: color name or hex (`##RGB`, `##RRGGBB`, `##RRGGBBAA`).    |
| borderType | string  | No       |         | Border type: one of `zero`, `constant`, `copy`, `reflect`, or `wrap`.   |

## Returns

* **BoxImage**: The modified BoxImage instance with the border applied.

## Description

`ImageAddBorder` adds a border around the specified image. You can control the thickness and color of the border, as well as the border type. The image can be passed directly or referenced by variable name. The border type determines how the border is generated:

* `zero`: Border pixels are set to zero.
* `constant`: Border pixels are set to the specified color.
* `copy`: Border pixels are copied from the edge of the image.
* `reflect`: Border pixels are a reflection of the image edge.
* `wrap`: Border pixels wrap around from the opposite edge.

## Example

```boxlang
// Add a 10px black border to an image
img = ImageAddBorder(myImage, 10);

// Add a 5px red constant border
img = ImageAddBorder(myImage, 5, "red", "constant");
```

## See Also

* ImageResize
* ImageCrop

## Notes

* The default border color is black if not specified.
* The default border type is implementation-dependent if not specified.
* The image can be passed as a BoxImage object or as a variable name referencing an image.


---

# 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/imageaddborder.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.
