Page 1 of 1

Perl. Using variables in the $image->Read('$tif_to_gif');

Posted: 2007-11-20T07:56:47-07:00
by Martin_Rose
Hi all,
I am trying to write a Perl script that reads in the graphic name as a variable and converts it from a tif to a gif.
A varied amount of graphics are uploaded into a directory on a daily basis that the script will auto process on.
Image magic works when I have the actual file name but will not work with the variables.
Am I doing this wrong or is it not possible to use image magic this way?
I have pasted my code below:
my $file = 12345678.tif;
my $file_1 = 12345678;

my $tif_to_gif = "/MartinR/graf-autoproc/$file";
my $gif_conversion = "/MartinR/gif/$file_1.gif";
my $x = $image->Read('$tif_to_gif');
$x = $image->Set(magick => 'GIF');
$x = $image->Write('$gif_conversion');
exit();
thanking you in anticipation
Martin :?

Re: Perl. Using variables in the $image->Read('$tif_to_gif');

Posted: 2007-11-20T08:04:30-07:00
by magick
Use double quotes (") rather than single quotes around your filename.

Re: Perl. Using variables in the $image->Read('$tif_to_gif');

Posted: 2007-11-20T08:17:47-07:00
by Martin_Rose
First off thanks for such a quick reply
Second thanks the solution to my problem.
Martin