perching_aix
7 hours ago
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.
hinkley
6 hours ago
By definition any chunk beginning with a lowercase is optional. I’m just surprised gamma is considered optional.
perching_aix
6 hours ago
Right, I guess that's our full story then. I further found some quibbles about that chunk being historically fraught specifically, so many decoders would intentionally ignore it under specific circumstances. I guess this file met the criteria.
hinkley
5 hours ago
I have a vague recollection of tangling with it myself. I worked with PNG decoding when it was a new format and that’s like 28 years ago.
brigade
6 hours ago
gAMA dates back to the days when hardly anyone had a clue about color primaries and colorspaces, let alone commonly tried to synchronize them across displays. It's explicitly ignored by everyone if the file uses any more modern method of signaling colorspace information, so really OP needs actually to write a colorspace to the file (cICP, iCCP, even an sRGB chunk) instead of merely claiming on their blog they wrote a colorspace.