"My images are all upside down"
gigpeppers.com
gigpeppers.com
If you're a developer who needs to occasionally inspect EXIF data from user uploads, please check it out. Contact me if you have additional questions, I'm happy to help.
[0] http://exif.in
Given that, OS X Preview has a different approach. It respects the EXIF orientation when you open a file, but when you re-save a file, it silently rotates the file and resets the orientation. Not sure if that is better or worse.
The concern is essentially that there may be many images on the web that have EXIF tags that don't match how those images are being used, specifically because the sites were tested in browsers that ignore the tags. So changing browser behavior now could suddenly break lots of sites that previously looked fine. It sounds like nobody has come up with a good solution yet.
Just curious. I'm sure many food photographers will try that position too.
I've been looking around to see if ImageMagick could do rotation without degrading quality. (I'd also asked a question about that elsewhere in this thread.) So I assumed that most devices use something similar even for displaying on the screen. It appears I assumed wrong. :)
I saw your other comment about axis-aligned rotation not being too computationally expensive. In that case, why aren't iPhones doing it by default? Wouldn't their computation power be comparable to that of most of the cameras that rotate the images? Or are cameras better equipped to handle such transformations?
It is not the rotation itself that is the problem, but saving the resultant file. If you're working directly with the pixel buffer you only do a lossless JPG rotation if the image height and width are multiples of 8 (or 16, in some situations). This is because once you've performed the rotation you'll need to save the resulting output as a JPG, and unless your dimensions factor into the block size you'll need to recompute. This SO answer covers it in more detail[1].
However, if you're not working with the pixel buffer this doesn't apply. You can use jpegtran (part of libjpeg), for example, which manipulates the JPG file directly and never decodes it. Many basic image viewers and editors (like the Windows Picture Viewer, and probably the iOS Photos app but I'm not sure) don't use this approach though.
[1]: http://photo.stackexchange.com/questions/12361/are-windows-p...
Unfortunately, with JPEG this would cause some loss of quality, so we're probably going to have to keep the original quality image as well as the auto-orient'ed image to display on the site. Has anyone here worked on something similar? Any ideas on a better way to handle this would be extremely helpful.
[1] http://www.imagemagick.org/script/command-line-options.php#a...
The better way though is to use a class like this: https://github.com/gpambrozio/GusUtils/blob/master/GusUtils/...
I see your point though - it's not trivial. I just happen to have a lot of experience in this area. I do a lot of video/imaging on the iphone.