【问题标题】:libpng warning: iCCP: known incorrect sRGB profile in .NET Corelibpng 警告:iCCP:.NET Core 中已知不正确的 sRGB 配置文件
【发布时间】:2022-01-19 06:02:10
【问题描述】:

我们有.NET Core 应用程序,它托管在基于 Linux 的 Docker 容器下。 System.Drawing 库在这里不起作用,所以我们需要使用命令 apt-get install -y --no-install-recommends libgdiplus libc6-dev 安装 libpng。

它解决了图像问题,但我们可以在 CloudWatch 中看到很多警告,例如 libpng warning: iCCP: known incorrect sRGB profile。我们还尝试设置 LogLevel "System.Drawing": "Error" 但没有运气。

有什么办法可以完全避免这些消息?

【问题讨论】:

  • 我相信如果 png 将 srgb 配置文件分配给黑白或灰度图像,就会发生这种情况。
  • @fmw42 用户可以自己上传任何文件,所以这不受我们控制。
  • 我的评论并不是为了解决问题,而只是对您收到此消息的原因的一种可能解释..

标签: linux docker asp.net-core rgb libpng


【解决方案1】:

Libpng-1.6 以后的版本在检查 ICC 配置文件方面比以前的版本更严格。每次发现损坏的 png 时都会打印此警告。可以忽略此警告,修复将包括:

1.Downgrade to an older version of libpng
2.Install imagemagick and use convert -strip to convert all .png files (script below)

将更改当前目录中所有 .png 文件的脚本:

for f in $(find . -type f -name "*.png")
do
echo "Processing $f ..."
convert $f -strip $f
done

更多可以参考这个帖子:

libpng warning: iCCP: known incorrect sRGB profile

【讨论】:

    【解决方案2】:

    我将所有与Image 进程相关的代码从System.Drawing 库替换为MagickImage,所以现在我不需要libpng。

    【讨论】:

      猜你喜欢
      • 2014-05-09
      • 2018-11-28
      • 1970-01-01
      • 1970-01-01
      • 2015-10-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多