Limit cropped image result min max size - ArthurHub/Android-Image-Cropper GitHub Wiki
You can restrict the crop result to minimum/maximum size, this will effect the crop window during cropping experience not allowing the crop window to exceed the restrictions.
On CropImageActivity
:
CropImage.activity(imageUri)
.setMinCropResultSize(100,100)
.setMaxCropResultSize(1000,1000)
.start(this);
or on CropImageView
:
<com.theartofdev.edmodo.cropper.CropImageView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/cropImageView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
custom:cropMinCropResultWidthPX="100"
custom:cropMinCropResultHeightPX="100"
custom:cropMaxCropResultWidthPX="1000"
custom:cropMaxCropResultHeightPX="1000"/>
Minimum crop window UI size
In addition the min/max restriction on the crop result size there is a UI restriction on the crop window size that prevents the crop window to be too small so its elements will overlap resulting in bad UX.
This minimum restriction may prevent crop window from reaching minimum result restriction, although due to zoom this is a rare case if your scenario requires it you can remove the restriction by setting it to 0.
On CropImageActivity
:
CropImage.activity(imageUri)
.setMinCropWindowSize(0,0)
.start(this);
or on CropImageView
:
<com.theartofdev.edmodo.cropper.CropImageView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/cropImageView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
custom:cropMinCropWindowWidth="0dp"
custom:cropMinCropWindowHeight="0dp"/>