How to easily resige images in Perl « Perl
How to easily resige images in Perl
Wednesday 17 March 2010 @ 6:46 am

How to easily resize images (jpg) in perl? Use Image::resize

use Image::Resize;
use autodie;

$src = "bigimage.jpg";
my $old = Image::Resize->new($src);
my $new = $old->resize(200, 300); # max dimensions

$jpegdata = $new->jpeg(95); # jpeg quality

open OUT, ">./smaller/$src";
print OUT $jpegdata;
close OUT;
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • Slashdot
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Twitthis
  • Yahoo! Bookmarks
  • Yahoo! Buzz

See also:

  1. installing from CPAN without root
  2. Utf8 in web perl application (LAMP) – binmode, charset
  3. Utf8 in web perl application (LAMP) – dbi, mysql
  4. Working as perl developer – telecommuting
  5. Perl as good as java, python and PHP way above

Tags: , ,

Comments (0) - Posted in work by  



Leave a comment