0

I have created a sample app for cropping images and I am calling the built-in crop intent.

Here is my code:

Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");                  
intent.setData(mImageCaptureUri);
intent.putExtra("outputX", 200);
intent.putExtra("outputY", 200);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", true);

How can I modify the crop area as per the user's input?

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Vijay Bagul
  • 237
  • 7
  • 18
  • [Android does not have a `CROP` `Intent`](https://commonsware.com/blog/2013/01/23/no-android-does-not-have-crop-intent.html). There are [many image cropping libraries](http://android-arsenal.com/tag/45) available. Please use one. – CommonsWare May 27 '15 at 15:44

2 Answers2

0

Yes you can, you need to change outputX/outputY and aspectX/aspectY according to your need. See also

Community
  • 1
  • 1
AAnkit
  • 27,299
  • 12
  • 60
  • 71
0

Just remove the output/aspect/scale parameters.

Intent intent = new Intent("com.android.camera.action.CROP");
intent.setType("image/*");                  
intent.setData(mImageCaptureUri);
intent.putExtra("return-data", true);

If this doesn't give you the result you want, try adding some of those parameters again, but not all.

Note! This action is not supported on all devices, so you should also check for ActivityNotFoundException when you start the activity, find an alternative way to crop on those devices or ask the user to install an app for that such as QuickPic.

Adam Nybäck
  • 845
  • 7
  • 13