Convert and GS

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
elcorazon

Convert and GS

Post by elcorazon »

I have a perl program that is converting a pdf file to a jpg using
imagemagik and gs. Using the following command line in a telnet shell
logged in as the webmaster and in the same directory as the perl
program it works:

cd Pages;/usr/local/bin/convert ZGRH3122CHAP070827063618-1-1.pdf -
resize 300 ZGRH3122CHAP070827063618-1-1.jpg


But when I do it in perl with the following:


system("cd $displaypath;/usr/local/bin/convert $THISPROJECT
$thepagemap[$i].pdf -resize 300 $THISPROJECT$thepagemap[$i].jpg");


which expands out to (same as above):


cd Pages;/usr/local/bin/convert ZGRH3122CHAP070827063618-1-1.pdf -
resize 300 ZGRH3122CHAP070827063618-1-1.jpg


I get this error:


sh: gs: command not found
convert: Postscript delegate failed
`ZGRH3122CHAP070827063618-1-1.pdf'.
convert: missing an image filename `ZGRH3122CHAP070827063618-1-1.jpg'.


Anyone have any clue why I would get this error? Convert works fine,
it just doesn't work with gs (ghostscript) when I call it from the
perl (but does work at the command prompt). Also gs is in /usr/local/bin same as convert.


Bill H
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Convert and GS

Post by magick »

The gs program is in your path when you execute the command from the shell but not when you execute it in your Perl script. Add the proper path to your Perl script or edit ImageMagick's delegates.xml configuration file and change the gs program to a fully-qualified path such as /usr/local/bin/gs.
elcorazon

Re: Convert and GS

Post by elcorazon »

magick wrote:The gs program is in your path when you execute the command from the shell but not when you execute it in your Perl script. Add the proper path to your Perl script or edit ImageMagick's delegates.xml configuration file and change the gs program to a fully-qualified path such as /usr/local/bin/gs.
Thanks - this will help. If I want to edit the delegates.xml - where do I find it?
elcorazon

Re: Convert and GS

Post by elcorazon »

magick wrote:The gs program is in your path when you execute the command from the shell but not when you execute it in your Perl script. Add the proper path to your Perl script or edit ImageMagick's delegates.xml configuration file and change the gs program to a fully-qualified path such as /usr/local/bin/gs.

I think I found it. In the config folder where I origanally "made" it. Do I change all instances of command='"gs" to command='"/usr/local/bin/gs" and then remake imagemagick?
elcorazon

Re: Convert and GS

Post by elcorazon »

elcorazon wrote:
magick wrote:The gs program is in your path when you execute the command from the shell but not when you execute it in your Perl script. Add the proper path to your Perl script or edit ImageMagick's delegates.xml configuration file and change the gs program to a fully-qualified path such as /usr/local/bin/gs.

I think I found it. In the config folder where I origanally "made" it. Do I change all instances of command='"gs" to command='"/usr/local/bin/gs" and then remake imagemagick?
After a little looking I found the correct config and modified it, works great! Thanks.
Post Reply