|
Using the latest version of GD there appears to be no quality difference between these two methods. Here are the relevant lines of code. The resulting jpeg is several magnitudes lower in quality than the original png. Using copyResized gives nearly exactly the same results. Am I missing something?
my $image = GD::Image->newFromPngData($image_data->{'imagefile'});
my ($orig_width, $orig_height) = $image->getBounds();
my $bound_ratio = 0.25;
my $height = sprintf("%.0f", ($orig_height*$bound_ratio));
my $width = sprintf("%.0f", ($orig_width*$bound_ratio));
my $blob = GD::Image->new($width,$height);
$blob->copyResampled($image,0,0,0,0,$width,$height,$orig_width,$orig_height);
$layout->{'images'}->{$_}->{'Sx'} = $width;
$layout->{'images'}->{$_}->{'Sy'} = $height;
$layout->{'images'}->{$_}->{'data'} = $blob->jpeg(100);
|