#!/usr/bin/perl -w use Imager; use strict; my $file = "something.jpg"; my $thumb_file = "something_thumb.jpg"; my $image = Imager->new() or die "Can't create Imager object"; $image->open(file => $file) or die $image->errstr; # You could also pass qtype => 'preview' to scale() to # supposedly make a smaller thumbnail (filesize wise) my $thumbnail = $image->scale(ypixels => 100) or die $image->errstr; # You could pass fd => fileno(STDOUT), instead of the file # parameter if you need to print to STDOUT. If you do so # make sure to binmode STDOUT, and disable buffering ($|++) $thumbnail->write(file => $thumb_file, type => 'jpeg') or die $thumbnail->errstr;