Skip to content

Fit-in

Use the fit-in argument to resize the image to fit within the specified dimensions without cropping.

To fill the remaining space with color, apply the fill filter: filters:fill(CCCCCC) using a hexadecimal RGB value (omit the #). For transparent fills, use filters:fill(transparent) combined with the format filter: :format(png).

In the interactive demo below, enable fit-in by enabling the background settings.

Preview that reacts to API
Copied to the clipboard
Background
Transparent

Was this page helpful?

What went wrong?

This site uses reCAPTCHA and Google's Privacy Policy. Terms of Service apply.