tags:

views:

36

answers:

2

How would one compress GIF image file in PHP5 ?

I know that its possible to do with JPG like this imagejpeg($resource, $filename, $quality) according to http://us.php.net/manual/en/function.imagejpeg.php

+2  A: 

JPG is a lossy compression. This means that you can use "quality parameter" to adjust size / quality ratio.

GIF is a lossless compression, you cannot get better compression by adjusting quality.

To create a GIF image use imagegif(...)
http://us.php.net/manual/en/function.imagegif.php

qbeuek
I know how to create gif image, but I did not know that you can't compress it. Thank you.
emcgfx
The gif format compresses data, but you cannot make it smaller by adjusting quality. If you like my answer, please accept it with the green tick.
qbeuek
A: 

If you want to open a GIF image, look at the function imagecreatefromgif: http://www.php.net/manual/en/function.imagecreatefromgif.php

The result can be passed to imagejpeg to be saved as a JPEG. Depending on the image, this might be pointless.

geon
Not what I need buddy, but thanks.
emcgfx