I am trying to resize the image using GD image library and perl, but when it is resized the quality of image is not same as original uploaded image.. Do you guys have any suggestion?
Below is my code
my $dest_w = $width;
my $dest_h = $width * ($h / $w);
my $dest = GD::Image->new($dest_w, $dest_h, 1);
$dest->copyResampled($src, 0, 0, 0, 0, $dest_w, $dest_h, $w, $h);
open OUT, ">$target" or die "Could not save to $target";
binmode OUT;
print OUT $img->jpeg($quality);
close OUT;
Anything wrong with my code? thanks for advice
Note: I uploaded .png image. Even if uploaded .jpeg image, the quality of the image is also dropped