Resize Fit Mode (fit)
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 is clip, crop, fill, scale. The default value is clip.
fit=clip
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. This fit mode is the default, so is not necessary.
Original

Resized - fit=clip&w=400&h=300

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.
Original

Resized - fit=crop&w=400&h=300

fit=fill
Resizes the image to fit within the requested width and height dimensions while preserving the Original aspect ratio and without discarding any Original image data. Excess space is filled with a solid color or blurred version of the image. The resulting image exactly matches the requested dimensions.
If you want to filled with particular color, you must use fill with value is color.
Original

Resized - fit=fill&w=400&h=300&fill=4bcffa

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.
Original

Resized - fit=scale&w=400&h=200

Resized - fit=scale&w=300&h=400
