Page 1 of 1

CommandException: 'gs' while trying to convert

Posted: 2017-12-19T22:43:07-07:00
by joshanashakya
Hello everyone,

I tried to convert pdf to image but got this error message:

org.im4java.core.CommandException: 'gs' -sstdout=%stderr -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r144x144' '-sOutputFile=/var/folders/n9/ykgrcs6n60vd805mr6mrnv0h0000gn/T/magick-1294bYHYFtaChjfp%d' '-f/var/folders/n9/ykgrcs6n60vd805mr6mrnv0h0000gn/T/magick-1294EQono57J3WJo' '-f/var/folders/n9/ykgrcs6n60vd805mr6mrnv0h0000gn/T/magick-1294yqfBAFSG3Vzl'

I am trying to figure out the problem. Any idea what's the problem?

Thank you
Joshana Shakya

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-20T01:25:16-07:00
by snibgo
It generally helps if you say what version IM you use, on what platform.

But the answer is that IM delegates reading PDF files to Ghostscript. If you haven't installed Ghostscript, that's the problem.

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-20T01:45:47-07:00
by joshanashakya
I have installed ghostscript and it worked.

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-25T22:31:07-07:00
by joshanashakya
Though I have been able to convert pdf to image after installation of ghostscript, I got the error message:

org.im4java.core.CommandException: org.im4java.core.CommandException: "gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r144x144" "-sOutputFile=/tmp/magick-469rWKTCxMHK7kT%d" "-f/tmp/magick-469jHztSM3q9nR9" "-f/tmp/magick-469_QtQgeUXyLnq"

trying to convert 1K pdf to image at once. Any idea how to solve this problem?

I am using 6.8.9 version and java platform.

Thanks

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-25T23:54:22-07:00
by fmw42
What was your exact command line?

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-26T00:13:03-07:00
by joshanashakya
I used run() method of org.im4java.core.ConvertCmd class in java 8 platform. And the exception occurred infrequently while converting those pdfs of size 44.6MB.

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-26T00:58:45-07:00
by fmw42
Perhaps you are running out of memory or tmp space.

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-26T02:25:49-07:00
by joshanashakya
Any idea to solve this problem?

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-26T06:50:04-07:00
by snibgo
joshanashakya wrote:Any idea to solve this problem?
First, find the cause of the problem. 45MB is large for a PDF, so I suspect as Fred says, you ran out of memory or /tmp. How many pages in the PDF, how many pixels per page? At 8 bytes per pixel, how much memory does that take?

Re: CommandException: 'gs' while trying to convert

Posted: 2017-12-27T23:59:46-07:00
by joshanashakya
Thanks, i am trying to solve.