Closed Bug 405398 Opened 17 years ago Closed 17 years ago

Grayscale PNGs displayed wrong

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: Dolske, Assigned: glennrp+bmo)

References

Details

Spinoff from bug 405384, when debugging a testcase for pngsuite image basn0g02.png... I noticed that the reference test result didn't actually match the original PNG when I loaded both into Gimp. The PNG is a 2-bit / 4-color grayscale PNG -- RGB vaues of 0/0/0, 255/255/255, 85/85/85 and 170/170/170 (triple checked with Gimp, Photoshop, and ImageMagick ("convert foo.png foo.txt")). Completely opaque, no gamma or color profile chunks. When generating the testcase with modules/libpr0n/test/reftest/img2html.html, the gray pixel values are reported as 155/155/155 and 212/212/212. That's noticeably brighter. I get the same results on OS X and Linux. I also took a screenshot, on OS X, of the browser and the OS X "Preview" app displaying the PNG image. The browser pixels are as the same as the test results (so <canvas> wasn't just misleading us). Interestingly, the pixel values in Preview are 138/138/138 and 167/167/167, so it seems to have trouble with this image as well! Maybe there's some implicit gamma correction going on that everyone is doing differently?
Flags: blocking1.9?
Do the results depend on the state of gfx.color_management.enabled?
The mapping of 85 -> 155 and 170 -> 212 are exactly what you'd get by applying a gamma of 1/2.2 (as in conversion of linear colorspace pixels to sRGB), so it does appear that there is some gamma correction happening.
gfx.color_management is disabled.
My copy of basn0g02.png from Pngsuite has a gamma=1.0 chunk, so what you are seeing on Firefox is what you should see. Run "pngcrush -n -v basn0g02.png" to see the gAMA chunk. "identify -verbose basn0g02.png" shows Gamma=1 too.
Assignee: nobody → glennrp
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
On, nuts. I see it in pngcheck now too. Either I overlooked it the first time, or I was looking at the wrong file. :-(
Resolution: WORKSFORME → INVALID
Flags: blocking1.9?
Blocks: 386651
You need to log in before you can comment on or make changes to this bug.