Background color

      Last updated May 18, 2020

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

    API Pattern



    Parameter Description
    bg-color Background color of the output image, when applying padding or when replacing transparent pixels.

    Parameter Values

    Value Description
    3- or 6-digit hexadecimal value With a 6-digit representation of a color, the first two digits (RR) represent a red value, the next two represent a green value (GG), and the last represent the blue value (BB). A shorter 3-digit version can be used for certain colors when the first and the second characters are the same, the third and fourth characters are the same and the fifth and sixth characters are the same. Example: bg-color=CC00DD can be shortened to bg-color=C0D while bg-color=CC01DD cannot be shortened.
    Red, Green, Blue Each value (red, green, and blue) defines the intensity of the color using an integer between 0 and 255. Lower numbers are less intense and higher numbers more intense.
    Red, Green, Blue, Alpha RGBA color values are an extension of RGB with an alpha channel. The alpha value is a number between 0.0 (fully transparent) and 1.0 (fully opaque).


    URL Description Demo
    <img src="image.png?bg-color=cccccc"/> Set the background to gray Example
    <img src="image.png?bg-color=000"/> Set the background to black Example
    <img src="image.png?bg-color=0,255,0"/> Set the background to green Example
    <img src="image.png?bg-color=0,255,0,0.5"/> Set the background to green with 50% transparency Example
    Back to Top