NYCPHP Meetup

NYPHP.org

[nycphp-talk] image resizing quality loss

Dan Cech dcech at phpwerx.net
Wed May 4 09:23:38 EDT 2005


You may want to look into using the imagecopyresampled function if you 
are running GD 2.0.1 or later.

I would also recommend investigating ImageMagick, as I've had very good 
luck with it in the past. (Personally I like to use the "montage" 
program it provides for doing image resizing and thumbnails.)

Dan

Rahmin Pavlovic wrote:
> I'm building a tool to resize large jpegs down to two smaller versions. 
>  The resized images look over-sharpened, with jaggedy-edges.  I can't 
> tell if this is a result of how I'm doing it or if it's something else. 
>  Here's basically what I'm doing:
> 
> $image_file=@imagecreatefromjpeg('temp.jpg');
> $new_image=imagecreate($new_width,$new_height);
> $new_image_name=$naming_convention.'.jpg';
> imagecopyresized($new_image,$image_file,0,0,0,0,$new_width,$new_height,$image_size[0],$image_size[1]); 
> 
> imagejpeg($new_image,$new_image_name,100);
> 
> Even tho I have the jpeg quality set to 100, the new images look way 
> brighter, sharper and more pixelated, detracting from the quality.  Does 
> anyone know if/how I can tweak this behavior?



More information about the talk mailing list