Skip to main content
Language

Configure Transforms

PhotoEditor SDK supports several configuration options for the transform tool allowing flexible adaptation to different needs and use cases. For a detailed explanation of how to configure different editor views, refer to this guide.

items#

The default configuration includes several different crop aspect ratios users can choose from. In order to restrict those to specific aspect ratios only, for instance, those used by social networks (e.g. Facebook, Twitter, Instagram, Flickr), we can specify aspect ratios as CropRatios and give it the desired width and height. The name argument to the CropRatio constructor allows using a custom name for the crop ratio. Note that setting the aspect ratio will not affect the resolution of the photo.

allowFreeCrop#

While it is possible to configure the available preset aspect ratios for cropping, we can also disable free cropping to ensure that the photo will always choose one of the available aspect ratios by setting allowFreeCrop to false.

showResetButton#

When free-crop is enabled, users need a way to reset the applied transform operations. In our example, since we are enforcing a certain set of aspect ratios, we can disable the reset button by setting showResetButton to false.

forceCrop#

Since in this example we enforce a certain set of aspect ratios, we need to ensure that one of the crop options is selected before any other editing operations are applied. To this end, we configure the editor by setting forceCrop to true. This ensures that the transform tool is presented first if the selected photo does not fit one of the allowed aspect ratios.