> This is the beginning of a subroutine that should convert pictures in other > formats to jpg. > > my($name) = shift; > my($img) = Image::Magick->new; > if (!($name =~ /.jpg|.JPG/)){ > > open(IMAGE, $name); # Open the original file > > $rc = $img->Read(file=>\*IMAGE); # Read the file To me, the above two lines are a somewhat cumbersome looking way of reading the file. If you must use a pre-opened file handle, maybe it would be worth figuring it out. One idea, is that if you are on Windows, it might be that you need to use "binmade" on the handle, before passing it it Read, I have no idea if Read does such internally. But it sounds to me that you would be just as happy using $rc = $mig->Read(filename=>$name); instead of the above 2 lines, and then... down below... > > print $rc; > > close(IMAGE); # Close the original file handle > > my($base, $ext) = split(/\./,$name); # extract the base of the file > name > > $name = "$base.jpg"; # Add the 'jpg' to the filename > > open(IMAGE, ">$name"); # Open the file for outputting the converted > image > > $rc = $img->Write(file=>\*IMAGE, filename=>"$name"); # Write the image $rc = $img->Write(filename=>$name); instead of the above 2 lines. > print $rc; > > close(IMAGE); # Close the file handle > }