Stretch, redimensionar, ou miniatura de uma imagem usando Perl
-
20-08-2019 - |
Pergunta
Como posso esticar ou redimensionar uma imagem (de qualquer formato) usando um script Perl?
Solução
Eu recomendo Imagem :: Imlib2 ... se você pode instalar imlib2 em sua máquina
Veja a documentação: Imagem :: 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");
Você pode também estar interessado em Imagem :: Imlib2 :: Thumbnail , se você não pode instalar imlib2 ter um olhar para imagem :: Magick
Outras dicas
Você pode usar Imagem :: Resize .
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow