identify fails if called from scanadf script

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
pphilw
Posts: 6
Joined: 2014-04-06T22:59:29-07:00
Authentication code: 6789

identify fails if called from scanadf script

Post by pphilw »

I have a script, which is called from scanadf. It converts the scanned pnm to a pdf file, and then calls identify. that call gives the following error:

identify: `%s' (%d) "gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pbmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" "-sOutputFile=/tmp/magick-8406Y34znpxiu1bz-1" "-f/tmp/magick-8406zpxPelFxv1o8" "-f/tmp/magick-8406-d8anTkmZ5BH" @ error/utility.c/SystemCommand/2029.
identify: Postscript delegate failed `001.pnm.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/713.

Calling identify from the command prompt works fine:
identify 001.pnm.pdf
001.pnm.pdf PDF 612x792 612x792+0+0 16-bit Bilevel Gray 61KB 0.010u 0:00.000
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify fails if called from scanadf script

Post by fmw42 »

just a guess, but your scanadf system probably does not know where Ghostscript is installed
pphilw
Posts: 6
Joined: 2014-04-06T22:59:29-07:00
Authentication code: 6789

Re: identify fails if called from scanadf script

Post by pphilw »

Thanks. But ghostscript is in the "standard" path ( /usr/bin/gs ). Also, the scanadf script inherits the shell environment (I checked by executing "env" from within the script). Any idea how to debug this further?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify fails if called from scanadf script

Post by fmw42 »

try renaming with only one period before pdf

001_pnm.pdf
pphilw
Posts: 6
Joined: 2014-04-06T22:59:29-07:00
Authentication code: 6789

Re: identify fails if called from scanadf script

Post by pphilw »

Thanks for the suggestion, but this does not help, either. I created a file test.pdf in my home directory, and the script called from scanadf only executes "identify /home/xxx/test.pdf". Here is the output:

Code: Select all

identify: `%s' (%d) "gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pbmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=/tmp/magick-5960NKTiA7Oc3RDu-1" "-f/tmp/magick-5960R2HCXd9VsHLI" "-f/tmp/magick-59601zlxWTKBcBTW" @ error/utility.c/SystemCommand/2029.
identify: Postscript delegate failed `/home/xxx/test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/713.
identify: `%s' (%d) "gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pbmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72"  "-sOutputFile=/tmp/magick-59623Lic0cn8loKu-1" "-f/tmp/magick-5962ZjgvOwsa3WOI" "-f/tmp/magick-59624XAor9MIyzTW" @ error/utility.c/SystemCommand/2029.
identify: Postscript delegate failed `/home/xxx/test.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/713.
On the other hand, if I call "identify /home/xxx/test.pdf" from the CLI, I get:

Code: Select all

/home/xxx/test.pdf PDF 612x792 612x792+0+0 16-bit Bilevel Gray 61KB 0.000u 0:00.000
Any other ideas?
pphilw
Posts: 6
Joined: 2014-04-06T22:59:29-07:00
Authentication code: 6789

Re: identify fails if called from scanadf script

Post by pphilw »

Interestingly, it works if I execute this in my scanadf script like this:

Code: Select all

ssh localhost identify /home/xxx/test.pdf
But this cannot be the "right" solution. I tried to execute it using "bash -c" and "bash -l -c", but none of those work.

Clearly, the "ssh-trick" is not a viable workaround, though.
pphilw
Posts: 6
Joined: 2014-04-06T22:59:29-07:00
Authentication code: 6789

Re: identify fails if called from scanadf script

Post by pphilw »

bump?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: identify fails if called from scanadf script

Post by fmw42 »

Is 001.pnm.pdf actually created by your script?
pphilw
Posts: 6
Joined: 2014-04-06T22:59:29-07:00
Authentication code: 6789

Re: identify fails if called from scanadf script

Post by pphilw »

Is 001.pnm.pdf actually created by your script?
yes
Post Reply