I have PDFs that I need to convert to images. I have installed Imagemagick. I have a PDF named a.pdf that I can open (it is not corrupt) in the folder C:\Convert\
From the command line I am trying
C:\Convert>convert a.pdf a.jpg
And I am getting the error.
convert.exe: FailedToExecuteCommand `"gswin32c.exe" -q -dQUIET -dSAFER -dBATCH - dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEV ICE=pamcmyk32" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dUseCIEColor "-sOutputFile=C:/Users/MNALDO~1.COR/AppData/Local/Temp/magick-3704HYGOqqIK5rhI%d " "-fC:/Users//MNALDO~1.COR/AppData/Local/Temp/magick-3704vK6aHo7Ju9WO" "-fC:/Use rs//MNALDO~1.COR/AppData/Local/Temp/magick-3704GQSF9kK8WAw6"' (The system cannot find the file specified. ) @ error/delegate.c/ExternalDelegateCommand/480. convert.exe: PDFDelegateFailed `The system cannot find the file specified. ' @ error/pdf.c/ReadPDFImage/797. convert.exe: no images defined `a.jpg' @ error/convert.c/ConvertImageCommand/323 0.
UPDATE:
After the SO community helped me solve this issue I put together a little tool to batch convert images. Hope it helps somebody. https://github.com/MattDolan/ImageConverter
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With