Skip to main content

Page last updated 07 October 2026

The background or bg parameter fills the transparent areas of an image with a colour. It is most often used with fit fill, which pads an image to the dimensions requested, and with a rotation that is not a multiple of 90 degrees, which leaves empty corners.

Colour values

The value is a hex colour, given with or without a leading # character, in any of these lengths:

DigitsMeaningExample
3Red, green and blue in shorthandbg=fff
4Shorthand with an alpha valuebg=fff8
6Red, green and bluebg=ff0000
8Red, green, blue and an alpha valuebg=ff000080

An alpha value below ff leaves the fill partly transparent. That is only visible in a format that stores transparency, such as PNG or WebP. A JPEG has no transparency to store, so a partly transparent fill is flattened.


Padding a fit

The coastal landscape padded to a square with white bands above and below

Filling the corners of a rotation

The coastal landscape rotated 20 degrees with dark blue corners

Give it after the transformation it fills

The parameter only fills transparency that exists at the point it is reached, so it must come after the transformation that creates it. In ?bg=ff0000&width=500&height=500&fit=fill there is nothing to fill when the colour is applied, so the padding is left transparent and the request appears to ignore it.

A background colour given for an image that has no transparent areas has no effect. It does not replace an existing background or tint the image.

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request