Quick question, and I really feel like a goon for asking it.
I'm using Image::Magick to resize pictures - follows is a snippet of a function I'm running and the invocation of it:
sub resize {
my $img=shift;
my $size=shift;
my $geometry;
if ( orientation($img)=="portrait" ){
$geometry="x" . $size;
} else {
$geometry=$size;
}
print "RESIZE: Geometry is $geometry, received $size, and it s
+hould be $sizes{$size}, pic is $img<BR>";
$img->Resize(geometry=>$geometry);
return $img;
}
What I'm seeing, when calling it like so:
my $tmppic=resize($pic,$sizes{$size});
and:
$ret=$tmppic->Write("jpeg:$dest");
my $tmpheight=$pic->Get('columns');
print "Orig: $tmpheight . Write to $tmppic $dest returned $ret
+<BR>";
Is rather troubling $pic itself changes the size, it seems that sub resize() received a reference instead of a value, but try as I might I couldn't copy the thing properly, including creating a new object and assigning.
I'm sure I'm missing something awfully basic here. Anyone feel like slapping me with some clue?
Thanks,
Nir.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.