Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Just as an aside, the ImageMagick ping method is the most efficient way to get size.
#!/usr/bin/perl -w use Image::Magick; my $x = $ARGV[0]; my $image = Image::Magick->new; #$image->Read($x); #my ($w,$h)= $image->Get('columns','height'); #print $x,' is ',$w.'x'.$h,"\n"; #this is very inneficient memory wise, use Ping ($width, $height, $size, $format) = $image->Ping($x); print $width,"\n", $height,"\n" ,$size,"\n", $format,"\n";
and here is a script I had in my library to do an actual distortion free resize.
#!/usr/bin/perl # I need to adjust an image to a minimum size, but without distoring i +t, # so I basically want to add space evenly around the existing image. # Using Resize is out since that will distort the image, so I gave # "Composite" a shot, use Image::Magick; use strict; use warnings; my $im = Image::Magick->new(); my $bg = Image::Magick->new(size => "200x400"); my $rc = $bg->Read("xc:white"); $rc = $im->Read($ARGV[0]); die $rc if $rc; $rc = $im->Resize("200x400"); warn $rc if $rc; $rc = $bg->Composite(gravity => "Center", image => $im); warn $rc if $rc; $rc = $bg->Write("$ARGV[0]-resized.png"); die $rc if $rc;

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

In reply to Re: determining size of image by zentara
in thread determining size of image by Anonymous Monk

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?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2023-03-22 08:46 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.