Page 1 of 1

problem using convert out of a CGI script

Posted: 2008-08-01T12:32:19-07:00
by nobody2100
I am on Mac OS X Leopard and I used fink to install imagemagick on my system. I have a local apache/MySQL server running using MAMP.
What I want to do is convert a .ps file into a .png file in a cgi script. I tried the following command:

Code: Select all

system("convert rna.ps rna.png"); 
(I also tried exec and qx btw)
But the script is not able to generate the png file. When i look into the apache_error_log there are these error messages related to the convert command:

Code: Select all

convert: no decode delegate for this image format `./gamedata/1148213059206768.ps'.
convert: Postscript delegate failed `./gamedata/1148213059206768.ps'.
convert: missing an image filename `./gamedata/1148213059206768.png'.
the folder I am operating on has chmod 777 and when i use

Code: Select all

system("whoami"); 
i get my username.
There is no problem when i go into the terminal and type in the command manually. I just tried everything and was wondering if someone might know a solution. PerlMagick is not a solution though, because my other server has that not installed.
Alex

Re: problem using convert out of a CGI script

Posted: 2008-08-01T12:55:32-07:00
by magick
Do you have Ghostscript installed? ImageMagick can utilize the Ghostscript library at build time if its framework is available, otherwise it uses the 'gs' command line utility to interpret Postscript. Make sure gs is in your execution path or edit delegates.xml and replace 'gs' with the absolute path of the utility, for example, /usr/local/bin/gs.

Re: problem using convert out of a CGI script

Posted: 2008-08-01T13:59:50-07:00
by fmw42
Pardon me for my lack of Unix experience. I have never been able to fully utilize the conversion of pdf with a manual install of IM and Ghostscript on Mac OSX Tiger.

I can do:
convert logo: logo.pdf (works fine)

but only after following the special Mac install instructions for Ghostscript:
*copy macosx.mak from src to top level of GS source directory
*rename to Makefile
*make framework
*copy framework from sobin directory of GS source code to /Library/Frameworks

when compiling IM, it still does not see gsc (and instructions in Ghostscript seem to be missing for how to install gsc), so that

convert logo.pdf logo2.png (complains about missing gsc, which the Ghostscript install does not seem to do)

So I would like to follow Magick's information and put gs is in my execution path, but I don't know how. I presume I edit my .profile file, but I do not know the proper syntax to do this.

Can anyone fill me in?

Thanks.

Re: problem using convert out of a CGI script

Posted: 2008-08-01T15:01:16-07:00
by nobody2100
magick wrote:Do you have Ghostscript installed? ImageMagick can utilize the Ghostscript library at build time if its framework is available, otherwise it uses the 'gs' command line utility to interpret Postscript. Make sure gs is in your execution path or edit delegates.xml and replace 'gs' with the absolute path of the utility, for example, /usr/local/bin/gs.
Wow! It worked! just replaced the gs with the whole path in delegates.xml and everything works like a charm! Thank you so much! Amazing support here... didn't expect a reply this quick! ;D
Alex