←back to thread

94 points justin-reeves | 5 comments | | HN request time: 0.005s | source
Show context
mzur ◴[] No.46005353[source]
Browsers starting to rotate images based on EXIF is such a pain. I maintain an image annotation tool and all of a sudden images were shown differently to users depending on the browser they used. Then you have to jump through all sorts of hoops to ignore the EXIF orientation again. In some cases you are not allowed to see if the orientation was changed for security reasons. And then the only way to control this is through a CSS attribute which only works if the element is in the DOM.
replies(5): >>46005381 #>>46005382 #>>46005519 #>>46005618 #>>46006856 #
coldpie ◴[] No.46005519[source]
Yes. I wrote a little image uploader script to easily upload images from my phone for embedding in web forums etc, and it strips out all the EXIF orientation and just converts it to the correct orientation. Aside from that I'm always having to fiddle with it in my image tools and hope every software I use supports it. It's such a crap feature. Just rotate the damn image, phones!
replies(1): >>46005560 #
circuit10 ◴[] No.46005560[source]
Wouldn’t that degrade the quality for a lossy format, especially if done repeatedly? I see why people would not want their phone to do that. If you’re uploading it somewhere that might not be supported it would be worth it but I don’t want my phone to silently degrade images that are just sitting in my gallery
replies(2): >>46005621 #>>46005855 #
1. justincormack ◴[] No.46005621{3}[source]
JPEG allows for lossless 90 degree rotation, not sure about other formats
replies(2): >>46005817 #>>46008716 #
2. derefr ◴[] No.46005817[source]
Pretty sure that any software from after ~2005 that supports image rotation, isn’t doing so at decoding time, but rather is decoding the image into a GPU texture buffer and then rotating the quad that texture gets applied to. Which should always be lossless for multiple-of-90-degree rotations. (Presuming that the image doesn’t depend on sub-pixel rendering tricks.)
replies(1): >>46005969 #
3. ryandrake ◴[] No.46005969[source]
Even without a GPU, the JPEG format itself allows for totally lossless rotation. It is also quite fast, and doesn't require reading and writing every pixel in the image.
replies(1): >>46008286 #
4. thunderfork ◴[] No.46008286{3}[source]
Isn't this only true for images where the resolution is divisible by the block size or something like that?

IIRC in other cases you have to cut the edge of the image off (rounded to the nearest block) or recompress those edge blocks

5. drewnoakes ◴[] No.46008716[source]
Is that still true if the image dimensions aren't a multiple of the block size?