---
title: "Image | Background Color"
description: "<p>The <span data-type=\"inlineCode\">bg-color</span> parameter lets you set a backgroud color for the given image. This is useful when applying padding or for replacing the transparent pixels of an image. There are three possible types of values for this parameter.&nbsp;
</p>
<p>The first type is the 3- or 6-digit hexadecimal value, for example <span data-type=\"inlineCode\">?bg-color=cccccc</span>.<br>
</p>
<p><img src=\"https://images.contentstack.io/v3/assets/blteae40eb499811073/bltc885de78ae1a1ae9/5a5339695a988db96e45e921/Change BG Color.png\" data-sys-asset-uid=\"bltc885de78ae1a1ae9\" alt=\"Change BG Color.png\" data-image=\"w23z03sqssj3\"></p>"
url: "https://www.contentstack.com/docs/developers/apis/image-delivery-api/background-color"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-06-02"
---

# Image | Background Color

The bg-color parameter lets you set a backgroud color for the given image. This is useful when applying padding or for replacing the transparent pixels of an image. There are three possible types of values for this parameter. 

The first type is the 3- or 6-digit hexadecimal value, for example ?bg-color=cccccc.  

![Change BG Color.png](<https://images.contentstack.io/v3/assets/blteae40eb499811073/bltc885de78ae1a1ae9/5a5339695a988db96e45e921/Change BG Color.png>)

### Change background color using hexadecimal value

**GET** `/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.png?environment={environment_name}&bg-color={value}`

**Note:** Check out the [limitations](/docs/developers/apis/image-delivery-api#limitations-with-optimizing-image) that are applicable here.

The second type is the Red, Blue, Green value which defines the intensity of the corresponding color, with the value ranging anywhere between 0 and 255 for each. An example of this is ?bg-color=140,220,123.

#### Query Parameters

- **bg-color** (optional)
  Enter the value for the background color. It should be a 3- or 6-digit hexadecimal value.
- **environment** (required)
  Enter the environment scoped to your delivery token.

### Change background color by Red, Blue, Green value

**GET** `/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.png?environment={environment_name}&bg-color={value}`

**Note:** Check out the [limitations](/docs/developers/apis/image-delivery-api#limitations-with-optimizing-image) that are applicable here.

And the last type is the Red, Blue, Green, Alpha value, which is an extension of the second type with an addition of the alpha element. The alpha value defines the transparency, with 0.0 being fully transparent and 1.0 being completely opaque. An example of this is ?bg-color=140,220,123,0.5.

#### Query Parameters

- **bg-color** (optional)
  Enter the value for the background color. It should be a Red, Blue, Green value.
- **environment** (required)
  Enter the environment scoped to your delivery token.

### Change background color by Red, Blue, Green, Alpha value

**GET** `/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.png?environment={environment_name}&bg-color={value}`

**Note:** Check out the [limitations](/docs/developers/apis/image-delivery-api#limitations-with-optimizing-image) that are applicable here.

#### Query Parameters

- **bg-color** (optional)
  Enter the value for the background color. It should be a Red, Blue, Green, Alpha value.
- **environment** (required)
  Enter the environment scoped to your delivery token.