1
votes

The goal is to allow the user to capture a new image with the camera on an Android device. I need the final image to be a square. I don't see a way to constrain the size of the capture image without using the Camera class and doing a lot more work.

What I would like to be able to do is start the camera activity using the MediaStore.ACTION_IMAGE_CAPTURE Intent action and have the Crop action be performed right after the image is capture. I am able to get the desired behavior by using the "com.android.camera.action.CROP" action in onActivityResult when returning from the camera but this returns the user to my app before starting the Crop action.

To summarize, what I have now is:

My-app -> Camera -> My-app -> Crop

and ideally what I would like is:

My-app -> Camera -> Crop -> My-app

(If it is possible to tell the image capture intent to use a specific size when opening the camera that would be great if I just missed how to do that.)

Thanks in advance.

1

1 Answers

2
votes

I am able to get the desired behavior by using the "com.android.camera.action.CROP" action in onActivityResult when returning from the camera but this returns the user to my app before starting the Crop action.

Android does not have a CROP Intent. Few devices will have an activity that supports your undocumented Intent action.

and ideally what I would like is: My-app -> Camera -> Crop -> My-app

You are welcome to use the camera APIs and an image-cropping library to do all of this work yourself.

Or, you are welcome to continue using ACTION_IMAGE_CAPTURE, but do the image-cropping yourself.

Or, you are welcome to stick with your existing code, bearing in mind that your image will not be cropped on most Android devices.