Skip to main content

Extend an image

Extends/pads the edges of the image with the provided background colour. This operation will always occur after resizing and extraction, if any.


Params

Top (t), Left (l), Bottom (b), Right (r)

The range for top, right, bottom and left parameters is from 0 to 500, with 10 as default. Default background color applied is black.

Background (bc)

The background colour for the padded area. bc is an alias for this parameter.

Uses hex value to determine background color. Default background color is black.

Border Type (bt)

This parameter decides how to fill extra space created by the pad parameters. bt is an alias of this parameter.

  • constant (default) - Fills extra space with solid color specified by parameter background. If background is not specified then access space will be filled with default black color.

  • replicate - Fills extra space by replicating the nearest pixels at the border of the original image.

  • reflect - Fills extra space by reflecting the image from the sides.

  • wrap - Fills extra space by wrapping the image at the opposite end of the side.

DPR (dpr)

Specifies device pixel ratio. dpr is an alias for this parameter.

Valid values are between 0.1 and 5, with the default value being 1 and floating point numbers are valid parameters. This acts as a multiplier for both width and height. width=200&height=300&dpr=2 is equivalent to width=400&height=600.

This makes it easy to specify an image with the correct resolution when using srcset attribute of the img tag.

Is this page useful?