-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JPG EXIF Orientation flag test #609
Conversation
iOS looks at the EXIF Orientation flag in jpgs and rotates the image accordingly. Looks like most desktop browsers just ignore this data.
Here's a test case for the need. Try opening this link up in iOS, then a desktop browser. The top image is normal, the second one has a class applied, which CSS rotates the image if need be. |
this is kind of fascinating. had no idea this was a thing. is there a URL with more of an explanation? if so can we include it in the js? test lgtm |
Oh wow that is very cool |
I haven't seen any testing on how to handle the fail case (everyone not iOS). I'm planning on digging into it more with some tests. I'm hoping iOS has a property on the img element, or some meta tag that says ignore the exif data. But you know how plans go... In the meantime, here's the test for it. ~ Paul On Jun 5, 2012, at 6:29 PM, Paul Irish reply@reply.github.com wrote:
|
is there a post or documentation on the bit or iOS's beavior? I just want something that explains what this test is looking for as part of the .js file |
I love this test but just want something to point to... quick research
|
merging. will add docs myself |
JPG EXIF Orientation flag test
I haven't found any good resources on this. What's worse, I haven't found a way to detect what way the image is rotated when the flag is set. The only good solution involves server side processing, which doesn't help us here. On Jul 19, 2012, at 6:32 AM, Paul Irish reply@reply.github.com wrote:
|
Hmm.. well i added in docs myself. why cant you check that a red pixel is red to determine how it was oriented? |
(assuming all supporting browsers also support canvas, which is fair, IMO) |
That's kinda how the feature detect works. There is a 2x1 image with the rotation flag set. If the browser reports the image as 1x2, then it's reading the exif data. The hard part is once you know the browser reads exif, which way is the image rotating, if at all. Tossing the image into canvas will rotate it the same way the browser renders it, so you it doesn't give you a different result. Luckily, this is only one browser right now, so there's still time to get a good solution. |
i see. this test shipped today in the 2.6 release btw http://modernizr.com/news/modernizr-260/ On Thu, Jul 19, 2012 at 5:28 PM, Paul Sayre <
|
I just noticed Webkit is getting support for the image-orientation CSS property. This may be a possible solution. Setting this property is supposed to tell the rendering engine to ignore the meta data. That said, I doubt it will be in iOS 6 when that comes out, so we are out of luck before that. I still haven't found a good solution for fixing iOS's behavior. |
Hmm.... Chrome Canary has support for this but is not passing the feature detect :/ @psayre-sc can you take a look? Demo image: https://raw.github.com/recurser/exif-orientation-examples/master/Landscape_5.jpg |
I tried opening the data uri directly and also saving it to file and opening that but Canary opens it only as 1x2 and not 2x1. I'm pinging our engineer |
|
JPG EXIF Orientation flag test
iOS looks at the EXIF Orientation flag in jpgs and rotates the image
accordingly. Looks like most desktop browsers just ignore this data.