Sets the background color of the image.

The bg-color parameter sets the background color of an image to use when applying padding or when replacing transparent pixels.



value may be one of:

  • Hex RGB value: Both 3- and 6-digit values are acceptable (e.g. a22 or cf23a5).
  • Decimal RGB: RGB values between 0 and 255. Comma-delimited (e.g. 255,0,0).
  • Decimal RGB with alpha| RGBA colors include an additional value for alpha (transparency), which ranges from 0 for fully transparent to 1 for fully opaque.


Click the links to view the transformed image using a demo Fastly IO service.

Example usageDescription
?bg-color=c5c5c5Set background color to grey
?bg-color=000Set background color to black
?bg-color=0,255,0Set background color to green
?bg-color=0,255,0,0.5Set background color to green with 50% transparency

User contributed notes


Do you see an error in this page? Do you have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact Fastly support)