Problems with linux Imagemagick converting PDFs to JPGs
-
05-07-2019 - |
Question
The system I'm using uses the linux utility convert to convert pdfs to jpgs. My box gives me the following error.
>$ convert Badge-1114044091.pdf Badge-1114044091.jpg
convert: Postscript delegate failed `Badge-1114044091.pdf'.
convert: missing an image filename `Badge-1114044091.jpg'.
But the production machine does not. According to
>$ convert -version
my version is the same as the prodution machine. I'm not sure exactly how to check if postscript needs to be updated. Not really a huge linux guru.
EDIT: Upon suggestion, I checked Ghostscript. The following was already installed.
>$ gs -version
ESP Ghostscript 8.15.3 (2006-08-25)
Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved.
Solution
Install GhostScript.
ImageMagick (the 'convert' utility) doesn't actually convert PDFs; it invokes GhostScript using an arcane command like
gs -q -sDEVICE=jpeg -dBATCH -dNOPAUSE -dFirstPage=1 -dLastPage=1 -r<OUTPUT RESOLUTION> -sOutputFile=<OUTPUT>.jpg <INPUT>.pdf 2>&1
You might want to try that command directly if you want more control.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow