ScaleMode

type ScaleMode = "cover" | "contain" | "stretch"

The mode tells the GPU resize pipeline how to map the input image into the output bounds when the aspect ratio doesn't match.

  • 'cover': Fill the whole output and keep the input aspect ratio. This performs a centered crop on the longer source axis.
  • 'contain': Keep the full source image visible and preserve aspect ratio. This adds black bars (letterboxing/pillarboxing) where needed.
  • 'stretch': Fill the whole output by stretching the input independently on each axis. The aspect ratio is NOT preserved — the input is squashed or stretched as needed to exactly match the output dimensions. No bars, no cropping.

On this page

No Headings