Live data from Hacker News

EXIF orientation info in PNGs isn't used for image-orientation: from-image

bugzilla.mozilla.org

61–70 of 91 posts

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#61
post #13

Earlier quoted context omitted.

I firmly believe every product team needs to be split in two: one half works on the issue of highest importance, the other works on the easiest issues. If only to avoid the embarrassment of easy to fix bugs that were passed over for eons just because they weren't priority-high.

There's something to this, although I think the idea needs some refinement. Anyone who's worked on a real software product knows that the "easy" bugs usually aren't actually easy (or else they would've been fixed already!). The way I've seen it implemented at a small company I worked at before was to explicitly endorse the "20% time" idea that Google made famous, where you may choose your own priorities for a fractio…

Thinking about it more, maybe the better approach is the 2nd team works on the oldest tickets. That's an objective measure that has no surprises and more directly addresses the problem of long-standing issues that are sometimes embarrassing because they turned out to be easy.

But in general, I do believe that teams should be split on the priority issue in some way. If all you are doing is chasing the highest priority stuff, you're going to miss important things because priority isn't an exact science either.

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#62

As a former metadata completionist, my mind starts to dissociate when I think about my battles with EXIF metadata, vendor-specific metadata, and the way different software supports, or refuses to support, any of it. It gets even worse when ingesting images into Apple Photos, where you have to confront papercut bugs that you know will never be fixed. I love ExifTool. It’s one of the great utilities. It works for almos…

> It gets even worse when ingesting images into Apple Photos, where you have to confront papercut bugs that you know will never be fixed. I wish they open-sourced their built-in macOS apps.

A nice compromise would be to open source the libraries that consume and emit data as well as core processing. Then they can add their own secret sauce UX and integration.

Likewise, that will never happen either.

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#63
post #26

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 th…

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.

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#64
post #51

Earlier quoted context omitted.

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.)

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.

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

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#65

Orientation in EXIF was an ugly hack and we're living with its fallout today. Cameras should have just rotated the actual image pixels when saving, instead of cheating. If that's too slow, implement it in hardware, or schedule a deferred process and don't let the images be exported until that's done.

> Cameras should have just rotated the actual image pixels when saving, instead of cheating. If that's too slow, implement it in hardware, or schedule a deferred process and don't let the images be exported until that's done.

What if I want to rotate an image by 90 degrees because my camera didn't correctly detect up & down?

To my understanding rotation is lossless, where as moving the data will incur quality loss (except for certain exceptions).

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#66

I personally like the status quo that PNGs don't encode orientation. I can dump PNGs when I'm debugging and I know I'm looking at the bits the same way up as the code is!

PNG now does - and they've been as vague as they could be in the spec about whether any exif data should affect the image display or not. The spec says: "It is recommended that unless a decoder has independent knowledge of the validity of the Exif data, the data should be considered to be of historical value only." Instead of either saying: "yes you must rotate it" or "no you shall not rotate it" to make everyone do…

That’s pretty typical in technical standards. It’s so that existing software isn’t forced to choose between the Scylla of not being able to claim conformance to the updated standard and the Charybdis of breaking backwards compatibility.

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#67

Earlier quoted context omitted.

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

JPEG allows for lossless 90 degree rotation, not sure about other formats

Is that still true if the image dimensions aren't a multiple of the block size?

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#68
post #28
post #26

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 th…

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.

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.

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#69
post #62

Earlier quoted context omitted.

> It gets even worse when ingesting images into Apple Photos, where you have to confront papercut bugs that you know will never be fixed. I wish they open-sourced their built-in macOS apps.

A nice compromise would be to open source the libraries that consume and emit data as well as core processing. Then they can add their own secret sauce UX and integration. Likewise, that will never happen either.

Yes, they used to compromise more along these lines in the past. e.g., Samba's vfs_fruit would never have gotten as good as it is without Apple open sourcing their SMBClient. Everyone benefits, even Apple (I'm sure they're running vfs_fruit on their server storage arrays internally). Wish they'd do it more.

Re: EXIF orientation info in PNGs isn't used for image-orientation: from-image

#70
post #63
post #26

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 th…

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.

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.

Post reply on HN