Page 1 of 1

convert failing on conversion from .ps to .png

Posted: 2009-09-29T17:32:12-07:00
by paustian
I think I know what is causing this, but for the life of me I cannot track down how to fix it.

I want to use convert as part of rendering equations spit out by Latex. I am using class.latexrender.php, So I downloaded all the software I need for this, using fink on mac OS X 10.5. Anyhow it seems as if everything is working up until the point the convert needs to do its thing. The php latex class then issues a command to convert the image like so.

Code: Select all

/sw/bin/convert -density 1.2 -trim -transparent "#FFFFFF" fe8e798694ec45f6e96f33e84f350b5c.ps fe8e798694ec45f6e96f33e84f350b5c.png
This fails. If I run it on the command line I get the following error.

Unrecoverable error: rangecheck in .putdeviceprops
Unrecoverable error: rangecheck in .putdeviceprops
convert: Postscript delegate failed `fe8e798694ec45f6e96f33e84f350b5c.ps': No such file or directory.
convert: missing an image filename `fe8e798694ec45f6e96f33e84f350b5c.png'.

I know the file convert is trying to work on is there. From googling around it seems this is a ghostscript error. I know ghostscript is installed, here are the versions of the programs.
convert
Version: ImageMagick 6.4.1 09/29/09 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC

ghostscript
GPL Ghostscript 8.61 (2007-11-21)
Copyright (C) 2007 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.

Both were installed using fink. Btw I set this up on a test server and was able to get it running.

Any help is appreciated.

Re: convert failing on conversion from .ps to .png

Posted: 2009-09-29T20:10:27-07:00
by fmw42
looks like your delegates are not where IM thinks they should be. type

convert -list configure

look at line starting with DELEGATES. See if it includes gs and png. If not, then IM does not know where you installed GS and PNG delegate libraries.

Did you install IM with FINK? If not that would answer it as FINK puts stuff in its own special directory.

P.S. I am on a Mac OSX Tiger and install manually as both FINK and MacPorts puts things in their own special directories. But more important, you may not be able to find or find current versions of things you want to install from their libraries. So installing manually allows you to use the latest versions whenever you want rather than waiting for FINK or MacPorts to get their binaries in order.

Re: convert failing on conversion from .ps to .png

Posted: 2009-09-30T06:24:01-07:00
by paustian
Thanks a bunch for the reply. I took another whack at it and finally cracked it. It was two problems. The first was that convert did not like my -density value. In face (hits palm on forehead) it was telling me so with the rangecheck warning. If you look at the convert manual -density it appears as if 1.2 would clearly be out of range.

So I fixed that problem in the php latex class. I then had the problem, as you suggest that convert cannot find gs. What it boiled down to was that /sw/bin was not in the PATH. I added a setenv('PATH=/sw/bin') to the latex class and it worked. However I am not really happy with this solution as it seems a bit of a kludge. Any suggestions on how I can set up my environment so that the www user has /sw/bin in its path?

Anyhow it works for now.