Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-25 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found