Specifies a padding size measured in pixels that will be added to the image.
If you need to specify a padding on specific sides of the image you can use padding-top
, padding-right
, padding-bottom
and padding-left
.
Padding will be affected by the value specified by background-color
parameter.
Values
This parameter accepts integer values in the range 0
to 500
with 0
disabling padding:
-
1
: specify a padding size of 1
pixel.
-
500
: specify a padding size of 500
pixels.
Padding will be added not increasing size values if specified. In the case that no size is specified padding will be added to the original image size.
Examples
In this example we are specifying a padding of 40
pixels with padding=40
. Because the image format does not support transparency and we are not specifying a background-color
value the padding will be applied and the default background white color will be see behind the padding area:
GET
https://assets.imglab-cdn.net/woman-03.jpeg?padding=40
For this example we are applying again a padding of 40
pixels with padding=40
and specifying a black
background color with background-color=black
:
GET
https://assets.imglab-cdn.net/woman-03.jpeg?padding=40&background-color=black
Applying a padding to a image format with alpha transparency support without specifying background-color
will result in a transparent padding:
GET
https://assets.imglab-cdn.net/woman-03.jpeg?padding=40&format=png
If we specify a background color with alpha component and the output format supports alpha transparency we will see a padding with alpha. In this example we are applying a padding of 40
pixels with padding=40
and a transparent background color with background-color=2B493E80
:
GET
https://assets.imglab-cdn.net/woman-03.jpeg?padding=40&background-color=2B493E80&format=png