Image Resizing default behavior of 'fit' parameter

Based on how images are resized, it seems like the default behavior of the ‘fit’ parameter is ‘scale-down’ (see the excerpt from the docs below). Currently my worker does not set a value for the fit parameter. When I try to resize an image with a width/height that is bigger than the original image, the image is not enlarged. This makes me think that the default behavior for ‘fit’ if this parameter is not set is ‘scale-down’ . Can anyone from Cloudflare confirm this?

From the docs

Affects interpretation of width and height. All resizing modes preserve aspect ratio. Used as a string in Workers integration. Available modes are:

  • scale-down
    Similar to contain, but the image is never enlarged. If the image is larger than given width or height, it will be resized. Otherwise its original size will be kept. Example:

You are correct; if you want to enlarge, include fit=contain in your parameter list.

This topic was automatically closed after 15 days. New replies are no longer allowed.