Skip to content
Arthur edited this page May 24, 2016 · 12 revisions

How to start the crop rectangle to completely fit the image?
Use cropInitialCropWindowPaddingRatio attribute and set it to 0.

How can I set crop shape to square/circle?
Set cropFixAspectRatio attribute to true and cropAspectRatioX, cropAspectRatioY to 1.

Why is the cropped image rectangular when I used oval crop shape?
The resulting cropped image is always rectangular simply because bitmaps are.
Usually the oval shape is created during rendering of the image, there are many solutions for it.
But if you do want the resulting image pixels to reflect the oval shape you can use CropImage.toOvalBitmap(Bitmap) helper method that does exactly that.

There are no buttons on CropImageActivity
If your main theme has NoActionBar then you need to specify on the activity to use theme with action bar

<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
    android:theme="@style/Base.Theme.AppCompat" />

Selecting camera from pick image chooser doesn't work on Android Marshmallow
If you request <uses-permission android:name="android.permission.CAMERA"/> permission in the manifest then you must explicitly request Manifest.permission.CAMERA permissions at runtime.
See "Pick image for cropping from Camera or Gallery" for sample code and this issue for more details.

Starting CropImageActivity from fragment doesn't return result to onActivityResult
Make sure you call start(Context, Fragment) overload and super you you override the onActivityResult in the activity.
See "Using built-in Crop Image Activity".

Why is the cropped image in not the exact size I specified to getCroppedImage(int reqWidth, int reqHeight)
The requested width/height is an optimization to down-sample the cropped part to specific size, it may and probably will not be the exact size, see Loading Large Bitmaps Efficiently.