[android-developers] Re: Image captured from my app is rotated by default

2014-03-25 Thread Doug Gordon
This may not be related to your problem, but I believe that there are 
basically two ways that the orientation of a JPEG photo is determined. One 
is simply by the way the actual data in the file is laid out; for example, 
whether it is stored as 1024x768 or 768x1024. The other determinate is an 
(optional) datum in the file's metadata that specifies camera 
orientation and indicates the degrees of rotation. So even if a photo's 
data is stored as 1024x768, if the orientation data is +90, then it is to 
be displayed rotated to the right in 768x1024 format.

The problem that I've found is that not all devices or image 
processing/display software seems to use the metadata and, making things 
worse, may not propagate the data when saving a modified image. So I've had 
photos from my phone that I've had to rotate in image software to make them 
look right on my PC, but then I'll do something like upload them to 
Facebook and they're rotated the wrong way!

I might be wrong about this, but it's what I've concluded after playing 
around with various devices and image processing programs.

On Tuesday, March 25, 2014 2:07:37 AM UTC-4, Jags wrote:

 Hi All,

 I tried to capture an image and send it to server in my app. I did that 
 using camera intent. the problem is in my samsung galaxy s4 device the 
 image is rotated -90 degree by default. I read around web that it is a 
 problem with the samsung devices. But what is the best solution to it ? if 
 i rotate the image after capture, it becomes heavy image processing in my 
 app. What is the best approach to resolve this ? 

 in phonegap there is something like correctOrientation = true / false 
 what's its counterpart in native code ?

 thanks and regards
 jags


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: Image captured from my app is rotated by default

2014-03-25 Thread Nobu Games
This is expected behavior, and Doug's assumption is right. JPEG images may 
contain EXIF http://en.wikipedia.org/wiki/Exchangeable_image_file_formatdata 
blocks that also specify the orientation of the image. On your server 
you need to read the orientation data and use it to rotate the image into 
the opposite direction. If your server code is written in PHP you can use 
the Imagick library and the following functions for determining the 
orientation and rotating the image 
respectively:Imagick::getImageOrientation()http://www.php.net/manual/en/imagick.getimageorientation.php,
 
Imagick::rotateImage()http://www.php.net/manual/en/imagick.rotateimage.php
.
If the server software is written in Java you could use a library such as 
Metadata-Extractor http://code.google.com/p/metadata-extractor/ for 
reading the orientation and any image processing library of your choice for 
rotating the image.


On Tuesday, March 25, 2014 1:07:37 AM UTC-5, Jags wrote:

 Hi All,

 I tried to capture an image and send it to server in my app. I did that 
 using camera intent. the problem is in my samsung galaxy s4 device the 
 image is rotated -90 degree by default. I read around web that it is a 
 problem with the samsung devices. But what is the best solution to it ? if 
 i rotate the image after capture, it becomes heavy image processing in my 
 app. What is the best approach to resolve this ? 

 in phonegap there is something like correctOrientation = true / false 
 what's its counterpart in native code ?

 thanks and regards
 jags


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Android Developers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.