-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Set initial crop window rectangle
Arthur edited this page May 17, 2016
·
2 revisions
By default the initial crop window is set to cover 80% of the cropping image, having 10% padding from the image borders.
If fixed aspect ratio is set then the larger dimension will fit within padding and the smaller dimension will adjust by aspect ratio restriction.
You can change the initial crop window padding ratio and set it to 0.
On CropImageActivity
:
CropImage.activity(imageUri)
.setInitialCropWindowPaddingRatio(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:cropInitialCropWindowPaddingRatio="0"/>
If you know the best initial cropping window rectangle, using face detection for example, you can set it.
On CropImageActivity
:
CropImage.activity(imageUri)
.setInitialCropWindowRectangle(myRect)
.start(this);
or on CropImageView
:
mCropImageView.setCropRect(myRect);