Live data from Hacker News

PNG in Chrome shows a different image than in Safari or any desktop app

lr0.org

21–30 of 49 posts

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#21
post #14
post #13

> If you are using Firefox or a Chromium browser (for me Google Chrome 143.0.7499.170), it's very likely that you are seeing a very foggy version of the painting, however, if you download the image and open it with your default image viewer (or open it in the Safari browser), you will see the image normally. Why does the page 404 when opening the image? Bandwidth issue? Firefox issue? (Yes, the username is a joke - I…

It was a typo in the url, should have pointed to https://lr0.org/blog/i/2025-12-27_18-21-51_screenshot.png instead. I fixed it, thanks!

this picture does show differently in Chrome and Safari, but if I analyze it using the methods you did I arrive at a different result - I don't see an iHDR chunk there, instead I see a gAMA chunk and if I remove it with pngcrush it shows normally in Chrome.

maybe you linked a different picture?

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#22
post #3
post #2

Given the Safari team has been the major driving force behind support for wide gamut in web browsers (for the very obvious reason that all Apple devices ship with wide-gamut displays), I am extremely suspicious of the author’s assertion that Safari is ignoring an embedded ICC profile while Chrome and Firefox are doing the right thing. I think it’s far more likely that whatever chain of open-source image modification…

You can try. I'm on Safari Version 18.6 (20621.3.11.11.3) [Seqouia 15.6.1] on my Mac, unsure of the version in my iPhone and iPad, but all of them ignore the ICC profile.

Apple essentially invented color matching on personal computers back in the classic Mac OS days; it's hard to believe after all this time, they're not dealing with color correctly.

The WebKit blog from 2016:

WebKit color-matches all images on both iOS and macOS. This means that if the image has a color profile, we will make sure the colors in the image are accurately represented on the display, whether it is normal or wide gamut. This is useful since many digital cameras don’t use sRGB in their raw format, so simply interpreting the red, green and blue values as such is unlikely to produce the correct color. Typically, you won’t have to do anything to get this color-matching. Nearly all image processing software allows you to tag an image with a color profile, and many do it by default.

[1]: https://webkit.org/blog/6682/improving-color-on-the-web/

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#23
Something is off about this.

> Plot twist; here was never a gAMA chunk to begin with!

But I do see a gAMA chunk in the file?

> 00 00 00 04 67 41 4d 41 00 03 5b 5e 5c ff 26 78

Which decodes to a value of 2.19998. Conversely, I don't see any bundled ICC profiles (iCCP chunks).

Mind you, I am able to reproduce the different colors, so something is indeed wrong. Chrome (Windows) and the Photos app (MS Store) both present it as a washed out, ghostly image (I wouldn't describe it as foggy, as that to me suggests a blur as well, but alas). In contrast, when I open it in MS Paint (the modern, MS Store app version), I do get saturated colors.

UPDATE:

The gAMA chunk not only exists, its value is wrong! That's the author's issue. Either they authored the image incorrectly, or their authoring software is getting it wrong.

> Aha! Surely this is a gamma correction issue. Chrome must be applying gamma math differently than desktop apps.

And so the author was actually correct here, just the wrong way around. The actual gAMA value stored in the picture is ~2.2, while 0.45455 would be the correct value for a typical sRGB gAMA chunk (1÷2.2). Gamma is 1÷display_exponent, and so the usual "~2.2 gamma" you hear is actually that display_exponent in this context; see: https://www.w3.org/TR/2003/REC-PNG-20031110/#12Encoder-gamma...

After hex editing the gAMA chunk to actually feature the "default" 0.45455 instead, the image now renders correctly everywhere for me.

For those looking to repro, these are the bytes I substituted in:

> 00 00 00 04 67 41 4D 41 00 00 B1 8F 0B FC 61 05

The actual difference then is that apparently some apps simply ignore this chunk and just force 0.45455 anyways.

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#24

"Chrome was not wrong. it's doing proper color management by respecting the embedded ICC profile" That's not how color management is meant to work. The color profile tells you how the data is saved. If you are displaying it using a different color profile, then it needs to be converted. Displaying P3 in sRGB is doing it wrong. How can you conclude Chrome "was not wrong"?

> If you are displaying it using a different color profile, then it needs to be converted. Displaying P3 in sRGB is doing it wrong.

Correct. What's supposed to happen is P3 colors get converted on the fly to the their closest sRGB colors.

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#25

Image looks the same to me in Firefox (Linux) and Falkon as it does in image viewers (Gwenview and GIMP). Which in all cases seems kind of washed out, so I think that's the "smoky," not "normal" image but I'm not sure.

Try eog, if you have it. The colors look bright for me in that viewer.

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#26
post #19
post #8

Earlier quoted context omitted.

"correct" in fail, in the same way across browsers? that's hilarious. I forget that throughout the history of the internet the one thing we've been able to depend on is different browsers behaving the same way

interoperability of web features has never been this good and it's only getting better https://wpt.fyi/interop-2025 other than the Manifest v3 fiasco, we're probably living in the golden age of web interop

Ugh, I hate toggle switches like the Stable/Experimental one. Which one is selected? I can’t tell. Which one of them has the better results?

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#27

Something is off about this. > Plot twist; here was never a gAMA chunk to begin with! But I do see a gAMA chunk in the file? > 00 00 00 04 67 41 4d 41 00 03 5b 5e 5c ff 26 78 Which decodes to a value of 2.19998. Conversely, I don't see any bundled ICC profiles (iCCP chunks). Mind you, I am able to reproduce the different colors, so something is indeed wrong. Chrome (Windows) and the Photos app (MS Store) both present…

By definition any chunk beginning with a lowercase is optional. I’m just surprised gamma is considered optional.

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#28
post #2

Given the Safari team has been the major driving force behind support for wide gamut in web browsers (for the very obvious reason that all Apple devices ship with wide-gamut displays), I am extremely suspicious of the author’s assertion that Safari is ignoring an embedded ICC profile while Chrome and Firefox are doing the right thing. I think it’s far more likely that whatever chain of open-source image modification…

Another reader is claiming the gamma correction value is inverted and Firefox is ignoring it. Which seems plausible. I know when I implemented png I had some issues wrapping my head around the gamma correction function.

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#29
> This is an arbitrary picked image, hashed internally and mapped to this page. You will have to see it as long as you in my website. hash: eb46e097… → idx 29/166

What is this nonsense about? I’m on a tablet and over 1/3rd of my screen is basically telling me to go fuck myself?

Re: PNG in Chrome shows a different image than in Safari or any desktop app

#30
> What's Really Happening

> (1) The PNG contains an embedded ICC color profile* (likely Display-P3 or another wide-gamut color space),

Why didn't you check? From what I can tell when I did, there is no color profile in the original image so it'll default to sRGB. This really looks like a gamma issue of some sort (see @perching_aix's comment).

Post reply on HN