Page 1 of 1

unable to open image

Posted: 2019-05-15T21:13:18-07:00
by eswari
Hi All,

I am using the below command to print a gif file through laser printer from unix

convert image -density 100 -rotate 270 image.ps && lp -o fit-to-page -d printer1 -n 1 image.ps

When I am using this command directly in the command prompt from anywhere (form the folder where the image is placed or outside of the folder with full path), print is happening successfully.

When I use same command within a web application which is deployed in tomcat getting the below error

convert: unable to open image `image.ps': No such file or directory @ error/blob.c/OpenBlob/2701.
convert: unable to open image `&&': No such file or directory @ error/blob.c/OpenBlob/2701.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.
convert: unable to open image `lp': No such file or directory @ error/blob.c/OpenBlob/2701.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.
convert: unrecognized option `-o' @ error/convert.c/ConvertImageCommand/2314.
for:image

I have searched for this error in google but didn't help anything. How to resolve these errors and print the gif files to laser printer from unix

Thanks,
Eshwari

Re: unable to open image

Posted: 2019-05-16T02:37:29-07:00
by snibgo
"&&" is a shell (eg bash or Windows) facility which joins commands together into a single line so they are run, one after the other. From the error message, "&&" is not interpreted by your shell, so it is passed as an argument to the IM program "convert".

Because "&&" and other junk is passed to "convert", that program interprets "image.ps" as an input file, not an output file. It is trying to read it, and fails.

I don't know tomcat. I suggest you consult tomcat documentation for multiple commands.