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()keepssize.widthandsize.heightunchanged.fillImageToContainer()writes a centeredcroprectangle so the image fills the current box without distortion.fitImageToOriginalRatio()clearscrop.fitImageToOriginalRatio()resizes the image to fit inside the current box while preserving the source ratio.
Related Commands
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.