【问题标题】:OSX ImageMagick no decode delegate for this image format `PNG'OSX ImageMagick 没有此图像格式“PNG”的解码委托
【发布时间】:2021-08-24 21:27:52
【问题描述】:

尝试在 PNG 上运行 imagemagick 命令时出现以下错误:

$ identify image.png
identify: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/572.

事实上,我在 JPEG 上也得到了同样的结果。

我的系统详情: ImageMagick 使用 Homebrew 安装在 MacOS Big Sur 上:

$ brew info imagemagick
imagemagick: stable 7.1.0-5 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/opt/brew/Cellar/imagemagick/7.1.0-5 (799 files, 30MB) *
  Built from source on 2021-08-24 at 11:25:21

似乎代表已正确列出:

$ identify -version
Version: ImageMagick 7.1.0-5 Q16 x86_64 2021-08-22 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(5.0)
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms lqr ltdl lzma openexr png tiff webp xml zlib

这里,我假设来自delegates.xml 列表:

$ magick -list delegate | grep png
    blender =>          "blender' -b '%i' -F PNG -o '%o''\n'magick' convert -concatenate '%o*.png' '%o"
        bpg =>          "bpgdec' -b 16 -o '%o.png' '%i'; /bin/mv '%o.png' '%o"
 dng:decode =>          "ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i"
        png<= webp      "cwebp' -quiet %Q '%i' -o '%o"
        png<= bpg       "bpgenc' -b 12 -q '%~' -o '%o' '%i"
    blender =>          "blender' -b '%i' -F PNG -o '%o''\n'magick' convert -concatenate '%o*.png' '%o"
        bpg =>          "bpgdec' -b 16 -o '%o.png' '%i'; /bin/mv '%o.png' '%o"
 dng:decode =>          "ufraw-batch' --silent --create-id=also --out-type=png --out-depth=16 '--output=%u.png' '%i"
        png<= bpg       "bpgenc' -b 12 -q '%~' -o '%o' '%i"
        png<= webp      "cwebp' -quiet %Q '%i' -o '%o"

我确实通过自制软件安装了 libpngwebp...

但不知何故,我无法在任何 PNG 上运行 convert(或 identify)(也不是 JPEG……可能与其他图像类型相同)。我认为 IM 如何与委托库链接可能有问题?但我完全不知道要检查什么......

此外,这会返回一个空列表 - 我不确定是否应该是这种情况:

$ convert -list format

【问题讨论】:

  • 看来您是从源代码安装的。然后,您负责安装所有需要的委托库。您应该从代表附带的二进制文件中安装。
  • 我确实安装了代表,但由于某种原因,我没有意识到所有的编码器都在那里......不知道为什么在构建/配置过程中 env var 没有正确设置。检查我在下面发布的答案。谢谢!

标签: macos delegates imagemagick homebrew macos-big-sur


【解决方案1】:

找出问题所在...出于某种原因,用identify -debug module 调试identify,我们看到IM 找不到解码器模块...

$ identify -debug module image.png
2021-08-24T23:43:18+00:00 0:00.001 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.001 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.001 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.001 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.002 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.002 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.002 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.002 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.002 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.002 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/OpenModule/1273/Module
  Searching for module "PNG" using filename "png.la"
2021-08-24T23:43:18+00:00 0:00.003 0.000u 7.1.0 Module identify[10123]: module.c/GetMagickModulePath/546/Module
  Searching for coder module file "png.la" ...
identify: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/572.

注意到这一点后,我通过 env var 设置了编码器模块的正确路径:

export MAGICK_CODER_MODULE_PATH="$(brew --prefix)/Cellar/imagemagick/7.1.0-5/lib/ImageMagick/modules-Q16HDRI/coders"

【讨论】:

    猜你喜欢
    • 2015-07-12
    • 1970-01-01
    • 2019-04-25
    • 1970-01-01
    • 2016-10-02
    • 2012-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多