Jump to content

Presence of ICC profile causes invalid chromaticities in saved PNG


Recommended Posts

If you open a PNG (rose_eciRGB.png) with an embedded ICC profile (eciRGB v2) and then save it as a PNG (rose_pdn.png), applications using libpng (like ImageMagick) complain about "invalid chromaticities" in the cHRM chunk.
The embedded ICC profile is gone as well.

This doesn't happen when saving as a JPEG. 

Edit: I'm using v4.3.6 but this has happened since at least v4.2.16

 

PS testImages> magick.exe identify .\rose_eciRGB.png
.\rose_eciRGB.png PNG 70x46 70x46+0+0 8-bit sRGB 10840B 0.000u 0:00.000

PS testImages> magick.exe identify .\rose_pdn.png
.\rose_pdn.png PNG 70x46 70x46+0+0 8-bit sRGB 9060B 0.016u 0:00.011
identify: cHRM: invalid chromaticities `.\rose_pdn.png' @ warning/png.c/MagickPNGWarningHandler/1746.

 

rose_eciRGB.png

rose_pdn.png

Edited by akino_germany
version information
Link to comment
Share on other sites

Thanks, I'll check into it for the 4.4 release. It may just be a bug in WIC (Windows Imaging Component), but I've been able to work around many of those in the past.

  • Thanks 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

I think the main issue is accuracy. The chromaticities calculated by paint.NET from the ICC profile are a little off compared to the chromaticities used to define the profile in the first place:

         paint.NET  eciRGB
White x:  0.34576   0.34567 
White y:  0.35858   0.35850
Red x:	  0.67002   0.67
Red y:    0.33001   0.33
Green x:  0.20998   0.21
Green y:  0.71005   0.71
Blue x:   0.14000   0.14
Blue y:   0.08002   0.08

The sum of the Red x and y components is greater than 1, which they are not supposed to, hence the complaint from libpng.

Link to comment
Share on other sites

Well then that's almost certainly a WIC bug. Paint.NET doesn't do any calculations with the color profile, it's only supposed to read and preserve this data. WIC is probably storing it with insufficient precision, or converting to floating point, or something like that.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...