sub convert_images { my ($array) = (shift); foreach my $picture (@$array) { # read the image via a filehandle my $image = Image::Magick->new; open(IMAGE, "$picture"); $image->Read(file=>\*IMAGE); close(IMAGE); # resize the image to the correct width and height $image->Resize(geometry=>'450X300'); # write the image back to disk $image->Write(filename=>"$picture", compression=>'None'); } }