34

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?

Jason Sundram
  • 10,998
  • 19
  • 67
  • 84
Charlie Kee
  • 1,111
  • 3
  • 11
  • 26

7 Answers7

42

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

hjhart
  • 521
  • 4
  • 2
  • this worked for me after updating OSX. brew seemed to have become outdated and gs no longer existed in the right place. – nunb Oct 28 '13 at 09:37
  • 3
    Yes, this is probably the correct answer in general. – Petter Feb 11 '14 at 19:59
  • +1, yeah, its correct. for more info http://www.imagemagick.org/script/formats.php here – Selvamani Apr 21 '14 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! http://stackoverflow.com/questions/10455985/issue-with-imagick-and-also-with-phmagick-postscript-delegate-failed-no-such – Blitz Jun 02 '14 at 16:42
12

Try install GS:

$ brew install gs

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.

KenS
  • 27,930
  • 2
  • 31
  • 42
  • Hi Ken, Thanks for your help. I have followed your steps and i have attached a screenshot. http://dl.dropbox.com/u/5059542/Screen%20Shot%202012-03-21%20at%2012.13.15%20PM.png 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. – Charlie Kee Mar 21 '12 at 04: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 Mar 21 '12 at 08: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 :) – Charlie Kee Apr 04 '12 at 03:59
3

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

Nowaker
  • 11,112
  • 4
  • 47
  • 60
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.

JZYL
  • 201
  • 1
  • 8
1

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.

Tony
  • 11
  • 2
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.

MSpreij
  • 1,024
  • 13
  • 19