Re: GD2 gif resizing problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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....

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux