1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/perl use strict; use warnings; use 5.024; use utf8; use Imager; my $img = Imager->new; my $filename = shift; my $angle = shift // 45; $img->read( file => $filename ) or warn $img->errstr; $img->rotate( degrees => $angle ) or warn $img->errstr; $img->write( file => "ROT-" . $angle . "_" . $filename) or warn $img->errstr;
1 2 3 4 5 6 7 8 9 10 11 12
use Imager; my $img = Imager->new; my $filename = shift; my $angle = shift // 90; die "Nur 90, 180 und 270 als Rotation im Unhrzeigersinn" if ($angle !~ /^(90|270|180)$/); $img->read( file => $filename ) or warn $img->errstr; $img->rotate( right => $angle ) or warn $img->errstr; $img->write( file => "ROT-" . $angle . "_" . $filename) or warn $img->errstr;
1
2
3
4
$img->read( file => $filename ) or warn $img->errstr;
my $img_rotated;
$img_rotated = $img->rotate( degrees => $angle ) or warn $img->errstr;
$img_rotated->write( file => "ROT-" . $angle . "_" . $filename) or warn $img_rotated->errstr;
1
2
3
$img->read( file => $filename ) or warn $img->errstr;
$img = $img->rotate( degrees => $angle ) or warn $img->errstr;
$img->write( file => "ROT-" . $angle . "_" . $filename) or warn $img->errstr;