Re: GD2 gif resizing problem

From: Date: Thu, 16 Mar 2006 16:54:01 +0000
Subject: Re: GD2 gif resizing problem
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-232038@lists.php.net to get a copy of this message
tedd wrote:
Based on the area increase; I'd expect the file size to about double, not be 4x as large. $src_img = imagecreatefromgif($filename); $dest_img = imagecreatetruecolor($new_width, $new_height); Can anyone explain or have a solution?
Here's my take -- gif's are no longer supported by the GD library because of patent problems. So development of how to deal with them has been moved to png. Gif's have a 256 color palette, but PNG has a 48-bit color palette and using imagecreatetruecolor() you greatly increase the file size of the image . A better choice for your code would be to use imagecreate() which has a maximum of 256 color palette. Please post if this works or not. tedd
I tried that early on and the image quality went to hell. What I ended up doing was process the gif and check it's filesize. If too large, I then made the file a jgp, from the same GD image canvas. I then compressed the results in 5% "Quality" steps until the filesize is below a preset value. Al....

« previous php.general (#232038) next »