my $img = Imager->new(); $img->read(file=>"$config{'basepath'}pictures/$filename") or die $img->errstr(); $img = $img->scale(xpixels=>$config{'imgmax'},ypixels=>$config{'imgmax'},type=>'min'); $img->write(file=>"$config{'basepath'}thumbs/$filename", jpegquality=>25) or die $img->errstr;