Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

ImageMagick: PDF to JPG Conversion Error

📅 2010-Sep-25 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Problem

I tried to convert a PDF file to a JPG image using convert.exe from ImageMagick and got the following error:

$ convert Foobar.pdf Foobar.jpg
convert: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraph
icsAlphaBits=4 "-r72x72"  "-sOutputFile=C:/Users/Joe/AppData/Local/Temp/magick-p1m2jxT1" "-fC:/Users/Joe/AppData/Local/Temp/magick-tf9Qz_d_" "-fC:/Users/Joe/AppData/Local/Temp/magick-sa
5AGTv3" @ error/utility.c/SystemCommand/2093.
convert: Postscript delegate failed `Foobar.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/645.
convert: missing an image filename `Foobar.jpg' @ error/convert.c/ConvertImageCommand/2970.

Solution

It looks like the input or output filenames are missing or have some problem. Look closer and it is an error caused by gswin32c.exe. ImageMagick uses gswin32c.exe from the Ghostscript package to convert PDF files. So, to fix this error make sure that:

  1. Ghostscript package is installed.

  2. The directory containing gswin32c.exe is in the PATH environment variable.