Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable the libpng warning? (python, pygame) [closed]

Tags:

python

pygame

When I run my program it gives me the following warning:

libpng warning: iCCP: known incorrect sRGB profile

I know why this is caused, the sRGB is what it wants, but I use adobe photoshop RGB.

Just wondering if there is any code to disable the warning. It doesn't affect my program. It's just annoying.

Any help would be greatly appreciated!

(Please don't ask me to show my code, my code has nothing to do with this situation)

like image 823
killarviper Avatar asked Jun 20 '14 18:06

killarviper


People also ask

How to remove iCCP chunk?

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).


1 Answers

well, you can ignore the warning. I am using ImageMagick for image resizing, and for some png file, the following code will throw exception: iCCP: known incorrect sRGB profile `' @ warning/png.c/MagickPNGWarningHandler/1830

Blob ablob(cont.data(), cont.size()); // cont is the png file content.
Image image;
image.read(ablob);
image.resize( Geometry(100, 100) );

As it says, it's just a warning, you can put the image.read(ablob) in a try{}catch{} block, and ignore the exception. The object image now contains the integrated png data, and can be manipulated correctly.

like image 88
sparkling Avatar answered Oct 30 '22 18:10

sparkling