Padding
pad
Pads the image by the amount specified, as a whole number of pixels or a decimal fraction (see below). Must be positive.
If the image is requested without a specified width and height, padding will be added to the dimensions of the image. If the image is cropped or resized, the image (including the padding) will be sized to fit within the requested dimensions.
If bg is set, the padded area will be filled in with its value; otherwise it will be transparent if the output format allows transparency, and white if not.
There are four additional parameters for padding individual sides of an image, allowing for uneven padding. When used in conjunction with pad, these parameters will adjust the padding of the specified side of the image:
This parameter accepts a relative length: a whole number is pixels, and a decimal between 0 and 1 is a fraction of the wxh box when one is set, or of the picture otherwise, taken per axis.