Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem resizing image in Image::Magick

Status
Not open for further replies.

BenRussell

Programmer
Mar 12, 2001
243
US
Im am trying to resize an image (already on the server) to 120 pixels wide and 60 pixels high (120 x 60).

I am trying this right now (Note: '$realFile' is the path to the file including the filename):

Code:
# Load Image::Magick
use Image::Magick;

my($image, $status);

$image = new Image::Magick;

# Read the image
$status = $image->Read("$realFile");
if ($status) { print "Error: $status"; exit; }

# Resize the image
$image->Set(geometry=>'120x60');

# Save the image
$status = $image->Write("$realFile");
if ($status) { print "Error: $status"; exit; }

And this does absolutely nothing to the file, but yields no errors either. - Ben
 
[tt]# Resize the image
$image->Set(geometry=>'120x60');[/tt]


should be:
[tt]# Resize the image
$image->Resize(geometry=>'120x60');
[/tt]
 
Got it working.
I had to use this however:

Code:
$image->Resize(width=>'120', height=>'60');

Because
Code:
$image->Resize(geometry=>'120x60');

wouldn't seem to work for some reason. - Ben
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top