Image Fit Options

Overview

The most common use of the media transformation endpoint is to resize an original asset to match new dimensions. In many cases, the output dimensions will not match the input aspect ratio. Here is a sample of the current behavior of the image transformation endpoint.

Horizontal Input


Square Output

"contain" or "scale-down"

Scales, maintaining aspect ratio, to fully contain within the output dimension(s).

Output may be smaller on one dimension than requested.

"contain" will upscale if necessary, where "scale-down" will only reduce size.

"cover"

Scales, maintaining aspect ratio, to fully cover the output dimenisons, then crops the remaining area.

Thus the processed output will always match both provided dimensions.

Vertical Output

"scale-down"

"cover"

Vertical Input


Square Output

"scale-down"

"cover"

Horizontal Output

"scale-down"

"cover"

Notes and Next Steps

Clarifications and how to finish out Milestone 1's transformation flags

Clarifications

Next Steps

  1. Eliminate "clip". It was never defined and the term is already overloaded in our ecosystem.
  2. Rename "crop" to "cover" and confirm behavior — this seems to be what crop is alerady doing.
  3. Rename "scale" to "contain" and avoid stretching output content
  4. Lower priority asks:
    • Add "scale-down" to "contain" without upscaling.
    • Add "crop" to "cover" without upscaling
  5. Out of scope:
    • Not now:
      • We will not support "trim" in the initial release.
      • We will not support "gravity" by coordinate weight in the initial release.
    • Not at all: *
      • We will not support "pad" at all.
      • We will not support "gravity" by automatic or tracking selection.

* You know how this goes. But not without a key account.