Missing Resizing Fit Mode

In my experience, there are only two useful fit modes when resizing images for the web, and it appears Cloudflare is missing one of them.

  1. Shrink to fit within a bounding box.
    Use cases include content photos, galleries, and full-size product photos. Cloudflare calls this mode scale-down.

  2. Crop to a specified shape (aspect ratio) and maximum size, but never enlarge.
    Use cases include profile photos (square), cover photos (extra-wide), thumbnail grids (square). I believe this should be the actual behavior of cover. For instance, give me a thumbnail of size 512×512, but if the source image is 400×600, crop to 400×400 instead.

I have never found a need for server-side enlarging or letterboxing (e.g. contain and pad). That should be done client-side to save bandwidth. Am I missing something, or is there truly no way to guarantee a shape without enlarging?

I’ve definitely seen cases where a user-agent required the exact size, and some resizing tools give slightly off images (1920x1079 for example), so forcing the output size is desirable, rather than a bounding box resize.

Somebody knowledgeable might know if it is possible to force an aspect ratio before doing a contain.

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