top | item 46005353

(no title)

mzur | 3 months ago

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.

discuss

order

Linkd|3 months ago

The amount of time I've spent dealing with this over the years is just incredible.. It's gotten to the point where during ingestion we auto-rotate everything just in case and strip out exif orientation metadata and never have to deal with it again.

jjcm|3 months ago

This is the correct approach in my opinion. Metadata should not be used to control rotation - there are just too many edge cases for where it can go wrong.

drittich|3 months ago

Yes, came to the same conclusion - it's a pain, but solves the problem permanently.

coldpie|3 months ago

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!

circuit10|3 months ago

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

bastawhiz|3 months ago

> In some cases you are not allowed to see if the orientation was changed for security reasons.

This is only true for cross-origin images, no? Which is expected: you can't access data loaded from another origin unless it's been loaded with CORS.

taeric|3 months ago

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.

LeifCarrotson|3 months ago

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.

stackedinserter|3 months ago

I maintain a photo library project, I feel your pain. JPEG format is so crooked in so many ways.

It's shame that after so many years of development we ended up with such horrible formats like jpeg and mp4.