Suresh Sharma
Suresh Sharma

Reputation: 1844

How to crop image after capturing it from Camera in Samsung Galaxy S4

What i want to do is to capture image from Camera and then want to crop With equal Width, height. I am using following code which is working fine in Samsung S3 and similar devices. But when i tested application in samsung galaxy S4 it is not working just Capturing image and saved into sdcard but no cropping tool is Appeared in between.

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

                intent.putExtra(MediaStore.EXTRA_OUTPUT,
                        MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString());

                intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());


                // ******** code for crop image
                intent.putExtra("crop", "true");
                intent.putExtra("aspectX", 1);
                intent.putExtra("aspectY", 1);
                intent.putExtra("outputX", com.app.controller.Constants.MAX_WIDTH);  
                intent.putExtra("outputY", com.app.controller.Constants.MAX_HEIGHT);

                try {

                    intent.putExtra("return-data", true);
                    startActivityForResult(intent, PICK_FROM_CAMERA);

                } catch (ActivityNotFoundException e) {
                    // Do nothing for now
                }

Please help me if anybody have any experience in this reference.

Upvotes: 0

Views: 3375

Answers (1)

nunofmendes
nunofmendes

Reputation: 3791

Android does not have a crop intent/tool. That's why it can work in some phones, but not in others.

You can read more about this in this website from CommonsWare http://commonsware.com/blog/2013/01/23/no-android-does-not-have-crop-intent.html

You can checkout some libraries that do that (both retrieved from the website above):

https://github.com/lvillani/android-cropimage

https://github.com/biokys/cropimage

https://github.com/MMP-forTour/cropimage

https://github.com/dtitov/pickncrop

Upvotes: 3

Related Questions