Search code examples
androidimagecrop

How I can use com.android.camera.action.CROP with unspecified output size?


Usually com.android.camera.action.CROP will show device's crop action, I have tried but it require specified output size. Is there any simplest way to perform croping action without specified output size like IsseiAoki/SimpleCropView or steelkiwi/cropiwa?

Intent cropIntent = new Intent("com.android.camera.action.CROP");
cropIntent.setDataAndType(picUri, "image/*");
cropIntent.putExtra("crop", "true");
cropIntent.putExtra("outputX", 360);
cropIntent.putExtra("outputY", 360);
cropIntent.putExtra("return-data", true);
startActivityForResult(cropIntent, PIC_CROP);

Solution

  • Usually com.android.camera.action.CROP will show device's crop action

    No. Frequently it will crash with an ActivityNotFoundException. Android does not have a CROP Intent, and many Android devices will not ship with a camera app, or any other app, offering com.android.camera.action.CROP. Beyond that, com.android.camera.action.CROP is undocumented, and so what extras are honored, and what those extras mean, will vary by activity.

    Is there any simplest way to perform croping action without specified output size

    Find and use an image-cropping library that offers the feature set that you desire. You appear to list two of them in your question.