Skip to content
Arthur edited this page Jul 21, 2017 · 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" />

Fragment onActivityResult doesn't work

Make sure you call start(Context, Fragment) overload.
Make sure you call super if you override the onActivityResult in the activity.
See "Using built-in Crop Image Activity".

How to change pick image chooser title?

Use pick_image_intent_chooser_title string resource or CropImage.getPickImageChooserIntent(context, title, includeDocuments) intent creation method.

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.

Why image captured from Camera is blurred or low quality?

You are probably using the thumbnail image.
You need to set the EXTRA_OUTPUT to a path and camera will save the full image to this path.

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri outputFileUri = Uri.fromFile(new File(context.getExternalCacheDir().getPath(), "pickImageResult.jpeg"));
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);

How can I limit the size of the cropped image?

Use requested size parameters to resize the cropped image to the requested size.

CropImage.activity(imageUri)
  .setRequestedSize(500, 500, CropImageView.RequestSizeOptions.RESIZE_INSIDE)
  .start(this);

How do I use custom request code for Crop Activity?

Get the intent and start it manually:

Intent intent = CropImage.activity(imageUri)
  .getIntent(getContext());
startActivityForResult(intent, myCode);

Changing crop_image_menu_rotate_left doesn't work

Make sure you replaced all 4 dpi variations resources (hdpi, xhdpi, xxhdpi, xxhdpi) and rebuild the project.

When I get cropped image it all shown black

Your image may be too large and you are hitting max allowed texture size limitation (example question). You can limit the size of the resulting cropped image, see how-can-i-limit-the-size-of-the-cropped-image.