Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I'm converting pdf to jpg with the following command

$ convert -density 300 file.pdf file.jpg

I'm getting this error.

Last OS error: 2 GPL Ghostscript 8.71: Unrecoverable error, exit code 1 convert: Postscript delegate failed file.pdf': No such file or directory @ pdf.c/ReadPDFImage/634. convert: missing an image filename file.jpg' @ convert.c/ConvertImageCommand/2838.

Could you help me with this command to work?

thank you

share|improve this question
1  
It would help if you'd add the exact command you're using to convert the .pdf to .jpg. But as an initial observation, it seems to complaining that you're missing an output image filename... –  lornix Oct 17 '11 at 9:11
    
@lornix Exact command is in the link. –  xralf Oct 17 '11 at 9:41
    
@jmtd Thanks you were a few seconds quicker in editing. –  xralf Oct 17 '11 at 9:42
    
WOW! convert is not at all efficient, ate up 3+Gig of ram, and took 28 minutes to complete a 202 page pdf->jpg. pdftoppm took 1:46, maxed out at 60-70 Meg of ram used. convert dumps the images into /tmp dir as png's, THEN converts to jpg and saves in current subdir. I just ctrl-C'd a run of convert, and it gives me the EXACT same error you show above. I imagine your system OOM killed the convert process, since it is a huge memory hog, a larger PDF file probably requires more ram for convert. very inefficient. –  lornix Oct 17 '11 at 11:22
    
@lornix But it was working in the past. It has great options to choose quality (with density switch) and quality is more important for me than speed. And the convert utility has so many options, I used it already many times for various tasks and it never disappointed me. –  xralf Oct 17 '11 at 11:30

1 Answer 1

up vote 2 down vote accepted

A method I've used in the past is to use the pdftoppm command (from poppler-utils).

Given a PDF file named 'MYFILE.pdf':

pdftoppm -jpeg MYFILE.pdf MYFILE

which will create (potentially) many files named 'MYFILE-?.jpg', where the '?' is replaced by the page number, padded so they're all the same length (if your PDF had 125 pages, each number would be 3 digits wide (005, 097, 124, etc).

Read the man page for pdftoppm for more information, you can adjust final size, DPI, output format (png, jpeg, etc), force black/white (mono) mode, and so on.

It's fast and works quite well for all my tasks. This is for Linux, Windows? ... GIMP (All platforms) will do this too, it's just a bit more convoluted.

====================

Playing around with 'convert' to process a 202 page PDF with lots of text and images, convert took over 28 minutes and ate in excess of 3G of ram.

I imagine your system killed the convert process due to OOM (out-of-memory) requirements, as I received the exact same error when I killed the job myself. convert seems VERY inefficient and slow, and a larger PDF (mine was 202 pages) probably requires much more memory than you have (physical RAM AND swap combined). Possible solutions would be: Buy more RAM, increase your swap partition/swap file total size or use a different program which isn't so wasteful of ram.

share|improve this answer
    
thank youk, I already used GIMP but I'm very used to convert utility and I wonder why it isn't working anymore. –  xralf Oct 17 '11 at 9:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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