Skip to main content
You're viewing documentation for a previous version of this software.Switch to the latest stable version
PESDK/Web/Concepts

Force Crop

You can force the user to crop the input image to one of a set of predefined ratios before he can do any additional editing to it. This is can be done by passing the option forceCrop to the editor, and setting the availableRatios of the transform tool to the desired allowed ratios:

const editor = new PhotoEditorSDK.UI.DesktopUI({
editor: {
forceCrop: true,
controlsOptions: {
transform: {
availableRatios: [
'imgly_transform_common_4-3',
'imgly_transform_common_16-9',
],
},
},
},
});

All other tools, except the library, when enabled, are disabled until the user accepts a crop transform with one of the given values.