Hi,

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->Strip; 
        $IM->Set(units => 'PixelsPerInch'); 
        $IM->Set(quality => 100); 
        $IM->Resample(geometry => "72x72", 
                      filter   => 'Lanczos'); 
        $IM->Resize(geometry => $fileSizes->{'hn'}->{width} ."x". 
                                $fileSizes->{'hn'}->{height}, 
                    filter   => 'Lanczos'); 
        $tmp = "$dir/hn.jpg"; 
        $IM->Write(filename=>$tmp, 
                   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?


In reply to ImageMagik & Perl::Magik, defaults? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.