pnggroup / libpng

LIBPNG: Portable Network Graphics support, official libpng repository
http://libpng.sf.net
Other
1.25k stars 612 forks source link

libpng warning: sRGB: out of place ! #487

Open sunmooncode opened 1 year ago

sunmooncode commented 1 year ago

This error appeared when I used the Python running program, where does this warning come from and how do I get rid of it?

jbowler commented 1 year ago

The warning indicates that a chunk (sRGB in this case) is in the wrong place in the PNG file/datastream. The file or stream needs to be fixed. The sRGB chunk has to occur before both PLTE and the actual data (IDAT), as do all encoding chunks (gAMA, cHRM, ICC chunks etc.)

sunmooncode commented 1 year ago

I need your help! I keep getting this warning message when I try to access a lot of data, and some of the images are causing it to pop up. Can you suggest any steps I can take to remove or temporarily disable this warning?

jbowler commented 1 year ago

This is nothing to do with libpng; libpng makes a function call in response to an image with a detectably misplaced chunk (sRGB in this case). You need to identify the program making the bogus images and report a bug there. As for the warnings the handling is a choice of the app you are using, apparently Python; talk to the devs of the Python reading code you are using.

In other words this is not a libpng issue.

jbowler commented 5 months ago

@ctruta - not-a-bug, by-design, as-intended, etc. On the other hand if the WC3 current proposals are accepted pngtest.png will become an invalid PNG.

I suggest that libpng get out of the business of being the PNG police; delete all the warnings and handle all the errors. It will serve you much better than having libpng being the boot boy.