Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:


I have just started trying to use ImageMagik and hope to use Perl::Magik. My current issue is trying to figure out how to go from using the ImageMagik command line tool "convert" to using the Perl::Magik functions. Specifically, I can do the following using the "convert" command line tool:

convert original.jpg -strip -density 72x72 -resample 72x72 -filter Lanczos -resize 200x200 cnv002.jpg 

and the result looks as good as rescaling the same image using Gimp. If I try to do the same things using Perl::Magik the result is very blurry. What "default" values is "convert" using? The blurry Perl code I have been trying is:

        $IM = Image::Magick->new; 
        $IM->Read($original) && 
            die __LINE__ . ": Could not do initial read on $original: $!"; 
        $IM->Set(units => 'PixelsPerInch'); 
        $IM->Set(quality => 100); 
        $IM->Resample(geometry => "72x72", 
                      filter   => 'Lanczos'); 
        $IM->Resize(geometry => $fileSizes->{'hn'}->{width} ."x". 
                    filter   => 'Lanczos'); 
        $tmp = "$dir/hn.jpg"; 
                   compression=>'None') && 
            die __LINE__ . ": Could not write to $tmp: $!"; 

I have tried a few other combinations and permutations of functions and settings but I can not duplicat ther command line results. Ideas? Pointers?