-2

How to get the path or uri of the original Image captured by the camera. when i use the following code it returns me the thumbnail image of the orginal image as its mentioned in google docs. I want the path or uri of the orginal image.

I have used the following code but it returns a thumbnail.

Bundle extras = data.getExtras();
            Bitmap imageBitmap = (Bitmap) extras.get("data");

            // CALL THIS METHOD TO GET THE URI FROM THE BITMAP
            Uri tempUri = getImageUri(getApplicationContext(), imageBitmap);

            // CALL THIS METHOD TO GET THE ACTUAL PATH
            File finalFile = new File(getRealPathFromURI(tempUri));

            Intent intent = new Intent(IdentifyActivity.this, detailedActivity.class);
            intent.putExtra("PATH", finalFile.getPath());
            startActivity(intent);

1 Answers1

1

You did not show the Intent that you used. I am assuming that it is ACTION_IMAGE_CAPTURE.

How to get the path or uri of the original Image captured by the camera

You don't, unless you supply the Uri to use via EXTRA_OUTPUT.

when i use the following code it returns me the thumbnail image

If you do not provide EXTRA_OUTPUT, ACTION_IMAGE_CAPTURE is supposed to give you a thumbnail.

I have already tried this method you said... it gives an error

Then perhaps you should ask a separate Stack Overflow question where you provide the code that you used and explain in detail what the problem was. This sample app demonstrates the use of ACTION_IMAGE_CAPTURE with EXTRA_OUTPUT.

there is original image in the gallery

There are ~2 billion Android devices, spread across ~10,000 device models. There are dozens, if not hundreds, of pre-installed camera apps. There are dozens, if not hundreds, of additional camera apps that the user can install from the Play Store and elsewhere. Your request could be handled by any of them, so do not assume that the behavior of one camera app is the same as the behavior for all of them.

There is no requirement for a camera app to write a full-size image to disk when a third-party app makes an ACTION_IMAGE_CAPTURE request for a thumbnail. In fact, I would consider it to be a bug if they do write out a full size image in that scenario.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491