Fit And Fill Images

Overview

Use the image-specific API helpers when you want predictable photo fitting behavior without manually editing size and crop.

API

// Keep the current image box and center-crop the source.
editor.fillImageToContainer(imageId)

// Clear crop and resize the image box to the source aspect ratio.
editor.fitImageToOriginalRatio(imageId)

What Changes

  • fillImageToContainer() keeps size.width and size.height unchanged.
  • fillImageToContainer() writes a centered crop rectangle so the image fills the current box without distortion.
  • fitImageToOriginalRatio() clears crop.
  • fitImageToOriginalRatio() resizes the image to fit inside the current box while preserving the source ratio.
editor.flipImageHorizontal(imageId)
editor.flipImageVertical(imageId)
editor.resetImageFilters(imageId)

Notes

  • These commands use the image source dimensions when available.
  • Legacy images without stored source metadata fall back to the best dimensions available on the object.