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

bugzilla.mozilla.org

85 points by justin-reeves 10 hours ago


postalcoder - 8 hours ago

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 almost every file I throw at it. But reading its output can be unsettling. It’s like getting a glimpse of eudaimonia, only to have it rudely interrupted by the reality of Apple Photos misreading every lens in your collection.

mzur - 8 hours 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.

afavour - 8 hours ago

> Further findings: neither Safari, Chrome, or Firefox respects exiftool's default output, which appends EXIF to the end of a PNG.

Makes sense. I have to imagine there is a performance impact to waiting until you've downloaded the entire image _just in case_ there's some metadata telling you to rotate it right at the end of the stream.

donatj - 9 hours ago

Interesting. I was not aware that was a thing. Orientation info seems way less useful in a lossless format like PNG. It makes sense in JPEG for instance because rotating and re-encoding would be lossy and slightly degrade the image.

t1234s - 8 hours ago

This is super useful if you need to learn how to manipulate exif orientation https://github.com/recurser/exif-orientation-examples

rkagerer - 7 hours ago

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.

alexdbird - 8 hours ago

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!

Linkd - 8 hours ago

EXIF orientation has always been a massive pain to deal with. Specially with HEIC that keeps getting updated libheifs and causing all sorts of compatibility issues.

qwertyuiop12 - 2 hours ago

I don’t know “why”. Why the format defines a way to set the orientation instead of set a pixels matrix as it is.

LiamPowell - 9 hours ago

See also: The VLC bug that incorrectly applies right crops as left crops [1]. This bug report is from 2023, however the bug has existed as long as VLC has as far as I know.

I'm always surprised to see bugs like this where an extremely easy to test part of the spec just seemingly isn't tested and ends up as a bug that never gets fixed until many years later.

[0]: https://code.videolan.org/videolan/vlc/-/issues/28279

omoikane - 6 hours ago

I remember EXIF orientation in JPEG also took a few years to get fixed:

https://issues.chromium.org/issues/40448628

When it got fixed, some sites were still depending on the old behavior of not rotating JPEGs, and had to add "image-orientation:none" to explicitly ignore EXIF:

https://issues.chromium.org/issues/40716313

seam_carver - 7 hours ago

I once had to deal with an old website that ignored the orientation flag in jpg, so my iPhone portrait photos showed up landscape when I uploaded them.

Thankfully Finder in macOS has a way to remove the flag:

How to remove orientation from portrait photo from iPhone on macOS https://youtu.be/lWOlfjVyes4

I couldn’t find a way to do it in Preview, but Finder could do it.

pupppet - 8 hours ago

If this gets supported after the fact, aren’t people going to find some of their PNGs displaying upside down out of the blue?

malinens - 7 hours ago

On related note there is exiftool which tries to understand all those different formats

https://exiftool.org/

And it has it's own forums with tens of thousands of posts!

karel-3d - 8 hours ago

5 years is a short time for Firefox bugs.

Probably for WebKit and Chromium too; I have an open (silly) WebKit CSS bug for about 4 years now.

Barry-Perkins - 8 hours ago

[dead]

mightysashiman - 9 hours ago

Why does a bug report get shared on hn?

jancsika - 7 hours ago

One thing I miss in PNGs is text wrapping.

That, or even just a small javascript interpreter in PNG would greatly improve things for a lot of my clients.