Thread PerlMagick: 3:2 Thumbnail (8 answers)
Opened by Froschpopo at 2012-05-23 05:09

topeg
 2012-05-23 16:23
#158520 #158520
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
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');

View full thread PerlMagick: 3:2 Thumbnail