←back to thread

94 points justin-reeves | 1 comments | | HN request time: 0s | 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 #
taeric ◴[] No.46006856[source]
Isn't it a touch on the required side, though? I'm assuming the orientation is a common metadata element of phone produced images, in particular. I'd assume same for decent cameras.

Would love to see a good rundown of when you should rely on different approaches? Another thread pointed out that you should also use the color space metadata.

replies(1): >>46009116 #
LeifCarrotson ◴[] No.46009116[source]
Some systems seem to produce images where the pixel arrangement matches the sensor layout, which moves when you rotate the device, and they'll add EXIF metadata to indicate the orientation.

Other cameras and phones and apps produce images where the device adjusts the aspect ratio and order of the array of pixels in the image regardless of the way the sensor was pointed, such that the EXIF orientation is always the default 0-degree rotation. I'd argue that this is simpler, it's the way that people ignorant of the existence of the metadata method would expect the system to work. That method always works on any device or browser, rotating with EXIF only works if your whole pipeline is aware of that method.

replies(1): >>46009215 #
1. taeric ◴[] No.46009215{3}[source]
The advantage of the EXIF approach is you don't have to do nearly as much post processing of the data? In particular, I don't expect my camera application to need to change memory layout just because I have rotated my camera. So, if you want it to change the rows/columns on saving the image, that has to be post capture from the sensor. Right?

I think this is what you meant by "some systems" there. But, I would expect that of every sensor system? I legit never would have considered that they would try the transpose on saving the image off the sensor.