38

I am trying to convert a PDF to JPEG:

$ convert pdf-test.pdf pdf-test.pdf.jpg

However, I am getting this error:

convert: Postscript delegate failed `pdf-test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/664.
convert: missing an image filename `pdf-test.pdf.jpg' @ error/convert.c/ConvertImageCommand/3015.

Currently I am using this version of GS and ImageMagick on Mac OS X Lion:

$ gs -v
GPL Ghostscript 9.02 (2011-03-30)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.

$ convert -version
Version: ImageMagick 6.7.1-1 2011-07-21 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

Can anybody enlighten me on this?

1
  • 2
    This also happens when your "pdf" file is empty. Commented Mar 19, 2013 at 22:11

7 Answers 7

44

I was receiving the same error message. I then installed gs and the same command worked properly after that.

3
  • this worked for me after updating OSX. brew seemed to have become outdated and gs no longer existed in the right place.
    – nunb
    Commented Oct 28, 2013 at 9:37
  • +1, yeah, its correct. for more info imagemagick.org/script/formats.php here
    – Selvamani
    Commented Apr 21, 2014 at 11:17
  • Please note that if you're on mac and use brew, you also need to add a link to /usr/bin/gs for this to work correctly everywhere! stackoverflow.com/questions/10455985/…
    – Blitz
    Commented Jun 2, 2014 at 16:42
13

Try install GS:

$ brew install gs

1
  • 5
    Debian : aptitude install ghostscript Commented Jun 26, 2014 at 14:09
8

Well, its telling you thre is no such file or directory. Presumably you have checked the file exists. Have you tried using ./pdf-test.pdf, or using a fully-qualified path ?

Have you tried opening the file directly with GS rather than using ImageMagick ? Just to check the fact that GS is working properly. Somthinhg like:

gs ./test-pdf.pdf

ought to open the PDF file in a window.

3
  • Hi Ken, Thanks for your help. I have followed your steps and i have attached a screenshot. dl.dropbox.com/u/5059542/… Upon performing the convert pdf-test.pdf i can see a file without extension magick-1FxqMZQQ-00000001 being generated as shown on the screenshot. it is actually JPG file. What does this actually tell me ? Thanks man. Commented Mar 21, 2012 at 4:20
  • OK well that means that GS works, and is able to open the file without problems. The fact that you see a JPEG file being generated shows that GS is running for the convert step as well, and making a JPEG file. However it obviously doesn't have the correct name. What I can't tell you is why this is happening. Its possible that convert is supposed to rename or copy the file, or that it gave the wrong output filename to Ghostscript. I'm afraid you need someone who can help you debug 'convert' rather than Ghostscript :-(
    – KenS
    Commented Mar 21, 2012 at 8:27
  • Hi Ken Thanks again for the help. i have decided to use GS directly instead relying on ImageMagick convert to run gs background...It works pretty much the same, if not faster in fact :) Commented Apr 4, 2012 at 3:59
3

ImageMagick sometimes throws this error when you choose too big resolution. Use -density parameter to limit it, e.g. -density 200.

3

I've encountered this problem today, and it seemed to relate to the overflowing of the /tmp volume. Specifically, it's the magick-* files that were overflowing the storage.

Freeing up the /tmp files solved the problem for me.

2

I encountered the same problem with MAMP 3.05 on Mac OS X 10.6.8 when trying to convert PDF files with PHP and Imagick to other formats. Conversion doesn't work and gives an error like "Postscript delegate failed... No such file...".

There is already a "gs" file in /Applications/MAMP/Library/bin/lib which comes when installing MAMP 3.05 package. But unfortunately, this file seems not to be in its good location, and this may explain why Ghostscript doesn't work.

The right place for "gs" file is /usr/bin. I tried to put an alias of the "gs" file from MAMP folder to /usr/bin, but it didn't work.

The good method is to make a new install of GS. Download the installer package from http://pages.uoregon.edu/koch/. The last update is 9.14, but on their site, they tell it is buggy in some cases. For this reason, I prefered to install Ghostscript 9.10.

When downloaded, launch the Ghostscript package. It's very easy ! GS installs itself in /usr/local/bin. Copy the "gs" alias from /usr/local/bin to /usr/bin. To do this, obviously, you must reveal hidden files in the finder with a tool like Onyx, choose your MAC OS X version at http://www.titanium.free.fr/downloadonyx.php

Restart MAMP and/or your computer. Now GS works properly, and PDF files can be converted to other picture formats.

Hope be helpful.

0

I got an extremely similar error message from PHP/Imagick/GS, it turned out the pdf in question was password-protected / encrypted. So maybe that's another possible cause.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.