0

Okay so here's a problem I have. setRotation() should rotate a captured JPEG image. It works fine on most phones, but somehow doesn't work on Samsung Galaxy S3 and S4.

Here's a question with a proposed soluton: setRotation(90) to take picture in portrait mode does not work on samsung devices

It involves manipulating the EXIF data, however, the ExifInterface() being used, requires the image to be saved to the phone, and then it uses the absolute file path.

However, I don't want to save the image to the phone, that's one of my main criteria. Any idea, on how to go about this issue?

Community
  • 1
  • 1
nitrobuster
  • 321
  • 3
  • 18
  • I don't understand your question, exactly. Do you want to rotate the image without saving? Then, you can refer to the ariefbayu's answer in [proposed solution](http://stackoverflow.com/questions/11023696/setrotation90-to-take-picture-in-portrait-mode-does-not-work-on-samsung-device). The imageUtil.rotate() method! then you can get the rotated bitmap object. and you don't have to do saving thing! – Sohyun Ahn Oct 23 '13 at 01:32
  • Yes, but he makes a call to imageUtil.rotate(), by first checking the current orientation of the image. Using ExifInterface, he checks TAG_ORIENTATION. How do I do that portion, without saving the image to the phone? – nitrobuster Oct 23 '13 at 14:22
  • Without using TAG_ORIENTATION, the other way to find rotated angle is using the orientation sensor. I think you want to rotate the photo depending on the orientation of phone. Right? If so, [this](http://stackoverflow.com/questions/9021890/get-phone-orientation-but-fix-screen-orientation-to-portrait) might help you. – Sohyun Ahn Oct 24 '13 at 07:37
  • That does, but that involves manually rotating the image matrix. It works yes, but isn't there another method, to touch an image Exif data, without saving it? Or some reference of how to be going about changing this particular field in the Exif data of the image manually? – nitrobuster Oct 28 '13 at 17:21
  • You can't use exif data without saving. Because Exif is the tag that specify image 'file'. But you can modify using ExifInterface. – Sohyun Ahn Oct 29 '13 at 01:32
  • I'm sorry I wasn't more specific, but I have the Byte array of the jpeg data with me, the file is saved on a server, so the application retrieves it from there, and I don't want to be saving it to the user's phone itself. – nitrobuster Oct 29 '13 at 17:19
  • Oh! Then, [this link](http://stackoverflow.com/questions/5468098/reading-exif-data-from-byte-array-in-android) helps you. I've never tried before, but it may works. – Sohyun Ahn Oct 30 '13 at 01:55
  • I think that should work. after looking up how Exif data works, and looking at the Hex maps of the images I'm using, but for some reason, can't get it to give the correct output, it always seems to return 0, as it doesn't detect the first byte properly. Though, if I get that to work, it would be just the thing I'd be looking for. – nitrobuster Oct 31 '13 at 15:08

0 Answers0