Imagemagick Convert PDF to JPEG: FailedToExecuteCommand `"gswin32c.exe" / PDFDelegateFailed

Solution 1:

You need to install Ghostscript in order to rasterize vector files (PDF, EPS, PS, etc.) with ImageMagick. IM will shell out to Ghostscript when doing these manipulations (you can see it if you use the -verbose tag in your IM invocation). You could also use Ghostscript by itself to rasterize vector files.

Solution 2:

Since you actually have to install Ghostscript to do this, why not drop ImageMagick all-together? It just forwards the command to Ghostscript anyway, not adding any value, just taking way longer to process (and loading everything into RAM while its at it).

Install GhostScript and run the command:

gswin64c.exe -dNOPAUSE -sDEVICE=jpeg -r200 -dJPEGQ=60 -sOutputFile=foo-%03d.jpg foo.pdf -dBATCH

This is identical and faster than running:

convert -quality 60 -density 200 foo.pdf foo-%03d.jpg

Solution 3:

It's in the docs now. https://github.com/dlemstra/Magick.NET/blob/master/Documentation/ConvertPDF.md

You need to install the latest version of GhostScript before you can convert a pdf using Magick.NET.

Make sure you only install the version of GhostScript with the same platform. If you use the 64-bit version of Magick.NET you should also install the 64-bit version of Ghostscript. You can use the 32-bit version together with the 64-version but you will get a better performance if you keep the platforms the same.

Here is a wrapper: https://archive.codeplex.com/?p=ghostscriptnet