user3000984 user3000984 - 1 year ago 528
C++ Question

libpng warning: iCCP: known incorrect sRGB profile

I'm trying to load a PNG file using SDL but the program doesn't work and this error appears in the console

"libpng warning: iCCP: known incorrect sRGB profile"

Why this warning appears?
what should I do to solve this problem?

Answer Source

Libpng-1.6 is more stringent about checking ICC profiles than previous versions. You can ignore the warning. To get rid of it, remove the iCCP chunk from the PNG image.

Some applications treat warnings as errors; if you are using such an application you do have to remove the chunk. You can do that with any of a variety of PNG editors such as ImageMagick's convert in.png out.png.

To remove the invalid iCCP chunk from all of the PNG files in a folder (directory), you can use ImageMagick's mogrify *.png, provided that your ImageMagick was built with libpng16 (run convert -list format | grep PNG to be sure of that).

Binary Releases Here

For Android Projects (Android Studio) navigate into res folder.

For example: C:\AndroidProjects\{your_project_folder}\app\src\main\res\drawable-hdpi\mogrify *.png

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download