如何禁用 libpng 警告?(蟒蛇,pygame) [英] How do I disable the libpng warning? (python, pygame)

查看:133
本文介绍了如何禁用 libpng 警告?(蟒蛇,pygame)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行我的程序时,它给了我以下警告:

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

libpng warning: iCCP: known incorrect sRGB profile

我知道为什么会这样,sRGB 是它想要的,但我使用 adobe photoshop RGB.

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.

任何帮助将不胜感激!

(请不要让我展示我的代码,我的代码与这种情况无关)

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

推荐答案

好吧,您可以忽略警告.我正在使用 ImageMagick 调整图像大小,对于某些 png 文件,以下代码将引发异常:iCCP:已知不正确的 sRGB 配置文件`'@warning/png.c/MagickPNGWarningHandler/1830

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

正如它所说,这只是一个警告,您可以将 image.read(ablob) 放在 try{}catch{} 块中,并忽略异常.对象图像现在包含集成的 png 数据,可以正确操作.

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.

这篇关于如何禁用 libpng 警告?(蟒蛇,pygame)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆