Question

Comment puis-je agrandir ou redimensionner une image (quel que soit son format) à l'aide d'un script Perl?

Était-ce utile?

La solution

Je recommanderais Image :: Imlib2 ... si vous pouvez installer imlib2 sur votre machine

Voir la documentation: Image :: Imlib2

use Image::Imlib2;

# load image from file
my $image = Image::Imlib2->load("in.png");

# get some info if you want
my $width  = $image->width;
my $height = $image->height;

# scale the image down to $x and $y
# you can set $x or $y to zero and it will maintain aspect ratio
my $image2 = $image->create_scaled_image($x,$y);

# save thumbnail to file
$image2->save("out.png");

Vous pourriez également être intéressé par Image :: Imlib2 :: Thumbnail , si vous ne pouvez pas installer imlib2, consultez Image :: Magick

Autres conseils

Vous pouvez utiliser Image :: Resize .

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top