Skip to main content
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 transform categories of the transform tool to the desired allowed ratios:

var editor = new PhotoEditorSDKUI({
forceCrop: true,
transform: {
categories: {
{
identifier: 'imgly_transforms_common',
items: [
{ identifier: 'imgly_transform_common_4' },
{ identifier: 'imgly_transform_common_16' }
]
}
}
}
})

It will load transform tool as default, if the image ratio doesn't match any of the ratios provided in config.