macos – ‘画像が定義されていない’ エラーのため、PDF を画像に変換できない

command-line conversion imagemagick macos pdf

私は以下のPDFファイルを持っています。http://www.fmwconcepts.com/misc_tests/pdf_tests/test.pdf

でも、経由して変換しようとすると

$ convert test.pdf test.png

以下のようなエラーが出てしまいました

convert: no images defined `test.png' @ error/convert.c/ConvertImageCommand/3187.

私は以下のバージョンを持っています

$ brew info libpng
libpng: stable 1.6.13 (bottled)

$ brew info libjpeg
jpeg: stable 8d (bottled)

$ brew info imagemagick
imagemagick: stable 6.8.9-7 (bottled), HEAD
ImageMagick – Mastering Digital Image Alchemy
ImageMagick is a free and open-source software suite used for editing and manipulating digital images. It provides a versatile set of tools for various image-re...
/usr/local/Cellar/imagemagick/6.8.9-1 (1432 files, 22M) * Poured from bottle From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/imagemagick.rb ==> Dependencies Build: xz ✔, pkg-config ✔ Required: libtool ✔ Recommended: jpeg ✔, libpng ✔, freetype ✔ Optional: fontconfig ✔, libtiff ✔, little-cms ✔, little-cms2 ✔, libwmf ✘, librsvg ✘, liblqr ✘, openexr ✘, ghostscript ✘, webp ✘

以下のようなデバッグログがあります

$ convert test.pdf test.png -debug all
2014-10-01T15:29:39+01:00 0:00.000 0.000u 6.8.9 Configure convert[58320]: utility.c/ExpandFilenames/944/Configure
Command line: convert {test.pdf} {test.png} {-debug} {all}
2014-10-01T15:29:39+01:00 0:00.000 0.000u 6.8.9 Configure convert[58320]: configure.c/GetConfigureOptions/679/Configure
Searching for configure file: "/usr/local/Cellar/imagemagick/6.8.9-1/share/ImageMagick-6/coder.xml"
...
2014-10-01T15:29:39+01:00 0:00.020 0.010u 6.8.9 Module convert[58320]: module.c/OpenModule/1268/Module
Searching for module "PNG" using filename "png.la"
2014-10-01T15:29:39+01:00 0:00.020 0.010u 6.8.9 Module convert[58320]: module.c/GetMagickModulePath/554/Module
Searching for coder module file "png.la" ...
2014-10-01T15:29:39+01:00 0:00.020 0.010u 6.8.9 Module convert[58320]: module.c/OpenModule/1277/Module
Opening module at path "/usr/local/Cellar/imagemagick/6.8.9-1/lib/ImageMagick//modules-Q16/coders/png.la"
2014-10-01T15:29:39+01:00 0:00.020 0.010u 6.8.9 Module convert[58320]: module.c/OpenModule/1304/Module
Method "RegisterPNGImage" in module "PNG" at address 0x10a9fdb60
2014-10-01T15:29:39+01:00 0:00.020 0.010u 6.8.9 Module convert[58320]: module.c/OpenModule/1318/Module
Method "UnregisterPNGImage" in module "PNG" at address 0x10aa0785d
2014-10-01T15:29:39+01:00 0:00.020 0.010u 6.8.9 Policy convert[58320]: policy.c/IsRightsAuthorized/574/Policy
Domain: Path; rights=Read; pattern="test.png" ...
...
2014-10-01T15:29:39+01:00 0:00.020 0.010u 6.8.9 Configure convert[58320]: locale.c/LoadLocaleCache/1186/Configure
Loading locale configure file "/usr/local/Cellar/imagemagick/6.8.9-1/share/ImageMagick-6/english.xml" ...
2014-10-01T15:29:39+01:00 0:00.020 0.020u 6.8.9 Exception convert[58320]: blob.c/OpenBlob/2657/Exception
unable to open image `test.png': No such file or directory
2014-10-01T15:29:39+01:00 0:00.020 0.020u 6.8.9 Cache convert[58320]: cache.c/DestroyPixelCache/962/Cache
destroy
2014-10-01T15:29:39+01:00 0:00.020 0.020u 6.8.9 Policy convert[58320]: policy.c/IsRightsAuthorized/574/Policy
Domain: Coder; rights=Read; pattern="PNG" ...
2014-10-01T15:29:39+01:00 0:00.030 0.020u 6.8.9 Coder convert[58320]: png.c/ReadPNGImage/4015/Coder
Enter ReadPNGImage()
2014-10-01T15:29:39+01:00 0:00.030 0.020u 6.8.9 Policy convert[58320]: policy.c/IsRightsAuthorized/574/Policy
Domain: Path; rights=Read; pattern="test.png" ...
2014-10-01T15:29:39+01:00 0:00.030 0.020u 6.8.9 Exception convert[58320]: blob.c/OpenBlob/2657/Exception
unable to open image `test.png': No such file or directory
2014-10-01T15:29:39+01:00 0:00.030 0.020u 6.8.9 Exception convert[58320]: png.c/ReadPNGImage/4021/Exception
unable to open file `test.png'

しかし、明らかなエラーは表示されません。そして、このデバッグログは、元のエラーが存在しないため、-debugがない場合とは全く異なる挙動をしているようです。完全なログを参照してください

http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=22466で同様の問題がありますが、私はかなりの解決策は何ですかそれを取得していません

  93  None  2014-10-01


ベストアンサー

オプションの Ghostscript 依存関係 gs がありません – これは PDF ファイルを変換したい場合にはオプションではありません

which gs が ghostscript バイナリに解決しない場合(同じ名前のエイリアスを持っているなど)、delegates.xml の Ghostscript へのパスを編集してください

101  dlemstra  2014-10-01


してみるのもいいでしょう

  1. brew ゴーストスクリプトをアンインストールします
  2. brew install ghostscriptをインストールします

それが私のためにそれを修正しました

79  hotmeteor  2014-12-11


私も同じような問題がありました。上記の修正では何もしてくれませんでしたが、ImageMagickが内部的にhtml2psを使っていたようです

ということで、解決策はそれをインストールすることでした。私はOS Xではないので、私にとっての解決策はそれでした

apt install html2ps

これが誰かの助けになることを願っています

-1  mlissner  2016-08-25


タイトルとURLをコピーしました