# ImageSetBackgroundColor

## Syntax

```
ImageSetBackgroundColor( name, color )
```

Or as a member:

```
someImage.setBackgroundColor( color )
```

## Arguments

| Name  | Type   | Required | Description                                                                          |
| ----- | ------ | -------- | ------------------------------------------------------------------------------------ |
| name  | any    | Yes      | The image to set the background color for. Can be a `BoxImage` object or image name. |
| color | String | Yes      | The background color to set (e.g., "white", "#FF0000").                              |

## Returns

`BoxImage` — The image object with updated background color.

## Description

Sets the background color of the specified image. Useful for preparing images for compositing, overlays, or ensuring a consistent background before further processing.

## Example

```boxlang
// Set background color to white
result = ImageSetBackgroundColor( myImage, "white" );

// Set background color using hex value
result = ImageSetBackgroundColor( myImage, "#00FF00" );

// As a member function
myImage.setBackgroundColor( "black" );
```

## Related BIFs

* ImageSetAntiAliasing
* ImageDrawRect
* ImageNew

## 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 when used as a member function.
* Returns the modified image object for chaining or further processing.
* The `color` argument accepts named colors or hex color codes.


---

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