Search Documentation

fit Resize Fit Mode

The fit parameter controls how the output image is fit to its target dimensions after resizing, and how any background areas will be filled

Valid values are clamp, clip, crop, facearea, fill, fillmax, max, min, and scale. The default value is clip.

fit=clamp

Resizes the image to fit within the width and height dimensions without cropping or distorting the image, and the remaining space is filled with extended pixels from the edge of the image. The resulting image will match the constraining dimensions. The pixel extension is called an affine clamp, hence the value name, “clamp”.

Example of how clamp works

fit=clip

Default. Resizes the image to fit within the width and height boundaries without cropping or distorting the image. The resulting image will match one of the constraining dimensions, while the other dimension is altered to maintain the same aspect ratio of the input image.

Example of how clip works

fit=crop

Resizes the image to fill the width and height dimensions and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. It’s used in conjunction with the the crop parameter, which controls how the image is cropped. Both the w and h parameters will also need to be set.

Example of how crop works

fit=facearea

Finds the area containing all faces, or a specific face in an image, and scales it to specified width and height dimensions. Can be used in conjunction with faceindex to identify a specific face, as well as facepad to include additional padded area around the face to zoom out from the immediate area around the faces.

Example of how facearea works

fit=fill

Resizes the image to fit within the width and height dimensions without cropping or distorting the image, and fills the remaining space with a solid color. The resulting image will match the constraining dimensions. The bg parameter must be set to the color desired to fill the space.

Example of how fill works Fill legend

fit=fillmax

Resizes the image to fit within the width and height dimensions without cropping or distorting the image, and fills the remaining space with a solid color. If the width or height of the specified dimensions exceeds that of the original, the original will remain the same size, and the remaining space will be filled with the set background color. The resulting image will match the constraining dimensions. The bg parameter must be set to the color desired to fill the space.

Example of how fillmax works Fill legend

fit=max

Resizes the image to fit within the width and height dimensions without cropping or distorting the image, but will not increase the size of the image if it is smaller than the output size. The resulting image will maintain the same aspect ratio of the input image.

Example of how max works Max legend

fit=min

Resizes and crops the image to match the aspect ratio of the requested width and height. Will not exceed the original width and height of the image.

Example of how min works

fit=scale

Scales the image to fit the constraining dimensions exactly. The resulting image will fill the dimensions, and will not maintain the aspect ratio of the input image.

Example of how scale works