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

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
Martin_Rose

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

Post 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 :?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

Use double quotes (") rather than single quotes around your filename.
Martin_Rose

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

Post by Martin_Rose »

First off thanks for such a quick reply
Second thanks the solution to my problem.
Martin
Post Reply