I am resizing jpeg images on the fly using GD 1.X and the images are being resized from 640-480 to 448 by whatever and the images are resizing but I am losing alot of quality.

My code sample is below. I was going to use imagemagick but my hosting provider does not have it installed, any suggestions.

$src_img = imagecreatefromjpeg("test.jpg");
$picsize = 100;
$new_w = imagesx($src_img);
$new_h = imagesy($src_img);
$aspect_ratio = $new_h / $new_w;
$new_w = $picsize;
$new_h = abs($new_w * $aspect_ratio);
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));

    Use NetPBM instead of GD, but mind you. Everywhere NetPBM isn't aailable, but it resizes images without loss of quality.

      If possible, try it with ImageCopyResampled() (PHP 4 >= 4.0.6)
      http://www.php3.de/manual/en/function.imagecopyresampled.php
      My be you'll get better quality (It depends on PHP Version and GD Version)

      Like jayant I'm using NETPBM "Netpbm image manipulation tools package"
      http://netpbm.sourceforge.net/netpbm.html
      http://sourceforge.net/projects/netpbm/
      http://www.mit.edu:8001/people/nocturne/etc/trans.netpbm.html
      http://pantransit.reptiles.org/prog/netpbm.html

      An alternative:
      http://imglib.sourceforge.net/

        Write a Reply...