Image-Scale

 view release on metacpan or  search on metacpan

tools/bench.pl  view on Meta::CPAN

        my $out = $jpg ? $img->as_jpeg() : $img->as_png();
        
        if ( !$saves->{resize_gm_fixed}++ ) {
            open my $fh, '>', 'resize_gm_fixed_point.' . ($jpg ? 'jpg' : 'png');
            print $fh $out;
            close $fh;
        }
    },
};

if ( ($jpg && GD::Image->can('newFromJpeg')) || (!$jpg && GD::Image->can('newFromPng')) ) {
    $tests->{gd_resample} = sub {
        my $src = $jpg ? GD::Image->newFromJpeg($path) : GD::Image->newFromPng($path);
        my $dst = GD::Image->new($width, $width);
        $dst->copyResampled(
			$src,
			0, 0,
			0, 0,
			$width, $width,
			$src->width, $src->height
		);

		my $out = $jpg ? $dst->jpeg(90) : $dst->png;



( run in 0.516 second using v1.01-cache-2.11-cpan-0a6323c29d9 )