title: Perl Image Resize using GD and maintain image quality
body: <p>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?</p>
  
  <p>Below is my code</p>
  
  <pre><code>my $dest_w = $width;
  my $dest_h = $width * ($h / $w);
  
  my $dest = GD::Image-&gt;new($dest_w, $dest_h, 1);
  
  $dest-&gt;copyResampled($src, 0, 0, 0, 0, $dest_w, $dest_h, $w, $h);
  
  open OUT, "&gt;$target" or die "Could not save to $target";
  binmode OUT;
  print OUT $img-&gt;jpeg($quality); 
  close OUT;
  </code></pre>
  
  <p>Anything wrong with my code? thanks for advice</p>
  
  <p>Note: I uploaded .png image. Even if uploaded .jpeg image, the quality of the image is also dropped</p>