I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2009-09-22 14:49:54-07 by cnighswonger
copyResized VS copyResampled: Both appear to adversely affect image quality
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);
Direct Responses: Write a response