2

My app is using image from phone camera or from image gallery. The issue is when picture from gallery/library is taken with front facing camera, because it would have diferent orientation than back camera. Is there any way to get info on which camera was used for thaking the image (was if front or back)? I can get orientatin of image, but no origin of image (aka front or back camera).

For example, this is how I open native camera app:

    Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    // Get file location.
    imagePath ip = new imagePath();
    File file = ip.getFile();

    // Put extra arguments into activity.
    camera_intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));

    // Start activity.
    startActivityForResult(camera_intent, CAM_REQUEST);

And in onActivityResult I have this code:

protected void onActivityResult(int requestCode, int resultCode, Intent     imageReturnedIntent) {
        switch(requestCode) {
            case CAM_REQUEST: 
                // Check result.
                if (resultCode != 0){
                    readBitmapInfo(); // Here I get image from stored location.
                }
        }
}

Any sugestion?

Jin Lee
  • 3,194
  • 12
  • 46
  • 86
Phil Boris
  • 104
  • 1
  • 8
  • can you posrt the code of how you get the image? – Jordi Castilla Aug 27 '15 at 14:45
  • Just added some example code. – Phil Boris Aug 27 '15 at 15:07
  • There is no way to derermine which camera was used, except for relying on orientation. It has been documented that Android will return an image flipped and rotated at 90 degrees if a picture was taken from the front-facing camera. So you can determine using ExifInterface and getting the image's orientation tag. – Sharp Edge Aug 27 '15 at 16:36
  • But there is no info that image was flipped or mirrored. Just from orientation there is no way to know this info. – Phil Boris Aug 28 '15 at 10:39

0 Answers0