1 2 3 4 5 6 7 8 9 10
my $v=$magick->Get('width')/$magick->Get('height'); if($v > 1) { # breiter als hoch } elsif($v < 1) { # höher als breit } else { # quadratisch }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use strict;
use warnings;
use Tk;
use GD;
use Image::Magick;
use Image::Size;
my $imageFile = "/home/student/Dokumente/Sonic_4_hero_version_2.jpg";
my $image = new Image::Magick;
$image->Read("$imageFile") or die;
$image->Scale('100 x 100');
$image->Read($imageFile) ...
1
2
3
4
5
6
7
8
9
10
11
12
13
use Tk;
use GD;
use Image::Magick;
use Image::Size;
my $imageFile = "/home/student/Sonic_4_hero_version_2.jpg";
my $image = new Image::Magick;
my ($x, $y) = imgsize($imageFile);
printf "$x..$y";
1
2
3
4
5
6
my $imageFile = "/home/student/Dokumente/Sonic_4_hero_version_2.jpg";
my $image = new Image::Magick;
my $res = $image->Read($imageFile);
warn $res if $res;
$res = $image->Scale('100 x 100');
warn $res if $res;
1
2
3
4
5
6
7
8
my $imageFile = "/home/student/Dokumente/Sonic_4_hero_version_2.jpg";
my $image = new Image::Magick;
my $res = $image->Read($imageFile);
warn $res if $res;
$res = $image->Scale('100 x 100');
warn $res if $res;
my ($x, $y) = imgsize($res);
printf "$x...$y";
1
2
3
4
5
6
7
8
9
10
11
12
13
my $imageFile = "/home/student/Dokumente/Sonic_4_hero_version_2.jpg";
my $image =Image::Magick->new;
$image->ReadImage($imageFile);
$image->Set(geometry=>'100x100') or die "$!";
$image->Write('bild.png');
my $witdh = $image->Get('columns');
printf $witdh;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#! /usr/bin/perl use strict; use warnings; use Image::Magick; my $imageFile = "/dev/shm/test.jpg"; my $image = new Image::Magick; my $res = $image->Read($imageFile); warn $res if $res; $res = $image->Scale('100 x 100'); warn $res if $res; my ($x, $y) = $image->Get('width', 'height'); printf "$x...$y\n";