Closed Bug 403423 Opened 18 years ago Closed 18 years ago

PNG files with sRGB chunk displayed improperly when color_management is enabled

Categories

(Core :: Graphics: ImageLib, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.9beta2

People

(Reporter: glennrp+bmo, Assigned: glennrp+bmo)

References

()

Details

Attachments

(2 files, 5 obsolete files)

The attached image, which is a grayscale PNG with only IHDR, sRGB, IDAT, and IEND chunks, is displayed improperly when gfx.color_management is enabled. See bug #403239, comments 14-18. The bug is probably in libpr0n/decoders/png/nsPNGDecoder.cpp at line 409 which fails to test for the presence of a valid sRGB chunk.
This patch and the patch in bug #403239 will bit-rot each other.
I think your diff is horked.
Comment on attachment 288246 [details] [diff] [review] Fixes bug in sRGB handling in nsPNGDecoder.cpp Horked, indeed. No idea how that happened.
Attachment #288246 - Attachment is obsolete: true
The other patch was horked by my fat finger hitting "]" and <ENTER> together instead of just <ENTER>.
Blocks: colorsync
Resolves merge conflict with checkin from bug #403239
Attachment #288251 - Attachment is obsolete: true
Comment on attachment 288497 [details] [diff] [review] Fixes bug in sRGB handling in nsPNGDecoder.cpp (v2) The problem seems not to be the lack of a gAMA chunk but the handling of a grayscale PNG image with an sRGB chunk. See http://www.simplesystems.org/users/glennrp/srgb.
Attachment #288497 - Attachment is obsolete: true
Changes grayscale to RGBA when sRGB is present and color_management is enabled.
Are you going to request review on your patch?
After I hear from someone that the patch works. Can't try it myself because I haven't got access to a platform with a sufficiently recent version of libpango installed, nor to the TriServer.
Hardware/OS -> All/All, since I see this in recent trunk Camino and Minefield on OS X PPC. I'll try to give this a test as soon as I finish pulling an updated tree.
OS: Windows XP → All
Hardware: PC → All
I can confirm the patch in comment 7 fixes this bug in a homemade build from this afternoon. Go ahead and target someone for review, as I have absolutely no idea whether or not this is the right approach. I just know that it worked. :)
Attachment #290035 - Flags: review?(tor)
Comment on attachment 290035 [details] [diff] [review] Fixes bug in sRGB handling in nsPNGDecoder.cpp (v3) I think that line should be inside the "if profile {}" block", but otherwise it seems correct.
I agree, inside the "if (profile) {}" block would be better. New patch coming shortly.
Moved inside "if (profile) {}"
Attachment #290035 - Attachment is obsolete: true
Attachment #290479 - Flags: review?(tor)
Attachment #290035 - Flags: review?(tor)
tor: Note that several other places the code has if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr); or similar. I omitted the test from the patch because it's redundant with tests inside libpng. I recommend removing all of them to save a few bytes of footprint. I'll post a new patch that does that if you like.
tor: The "v5" patch also removes the redundant tests -- take your pick of v4 or v5.
Attachment #290490 - Flags: review+
Attachment #290479 - Attachment is obsolete: true
Attachment #290479 - Flags: review?(tor)
Attachment #290490 - Flags: superreview?(pavlov)
Flags: blocking1.9?
Attachment #290490 - Flags: superreview?(pavlov) → superreview+
Attachment #290490 - Flags: approval1.9?
Attachment #290490 - Flags: approval1.9? → approval1.9+
Checking in modules/libpr0n/decoders/png/nsPNGDecoder.cpp; /cvsroot/mozilla/modules/libpr0n/decoders/png/nsPNGDecoder.cpp,v <-- nsPNGDecoder.cpp new revision: 1.76; previous revision: 1.75 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M10
Flags: in-testsuite?
Flags: blocking1.9?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: