Skip to main content

Page last updated 07 October 2026

When the fit=fill parameter is used in conjunction with the width and height parameters, the image is scaled to fit within those dimensions without cropping or distorting it, and the space left over is padded so that the result matches the dimensions exactly. The image is enlarged if it is smaller than the output size.

The colour of the padding is set by the background or bg parameter, given as a hex value. Without it the padding is transparent, which formats that cannot store transparency, such as JPEG, show as black. The background parameter must come after the fit, as it only fills transparency that exists at that point in the sequence.


The coastal landscape padded to a 600 by 600 square with dark blue bands above and below

The same request without a background, width=600&height=600&fit=fill, returns the same image with black bands, because the source is a JPEG.

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