Thread PerlMagick: 3:2 Thumbnail
(8 answers)
Opened by Froschpopo at 2012-05-23 05:09
Ohne es getestet zu haben:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 my ($w,$h)=$img->Get('width','height'); my $want_aspect=3/2; my $is_aspect=$w/$h; if($want_aspect-$is_aspect > 0) { $w=int((1/$want_aspect)*$h); } else { $h=int($want_aspect*$w); } $img->Crop(width=>$w, height=>$h, gravity=>'Center'); |