View Full Version : GD and GIF

03-18-2003, 01:57 AM
i want to support cropping and resizing a gif image my website, and simple way to do that with gd? any not simple way? I've heard something about converting gif to png and back to gif...

shed me some light, ya smarties!

03-18-2003, 02:44 AM
well not all versions of GD support GIF , most php4 versions certainly dont.

aside from that gif's lose quality and definition very fast when resizing so even if your version of GD does support gif you are better to convert to a jpg or png before any manipulation.

I am sure Okii can tell you more.

note that you can use ImageMagick or built in *NIX functions to convert gifs to other formats if necc'y before manipulation.

03-18-2003, 03:24 AM
well that was some kinda answer!! :confused:

Just kidding. ;)

I just need to be able to input a gif, convert it to a higher color depth format and output a gif... any method you can suggest would be great.

A note tho, that i'll just be running this on a regular old web host.. i wont have access to the machine to make sure they have all the bells and whistles for image manipulation... so i guess if you could just tell me what to look for in a host, as far as this concern, that would be great. Suggest a host? even better.

03-18-2003, 09:55 AM
why o why o why o why o why use such an nasty antiquated image format.???

The basics of why most open-sourced programs do not support gif are that unisys patented the LZW compression algorythm. As such, for any application to write compressed gif images requires that they pay unisys. Ergo most people just decided to drop gif entirely.

As you already no doubt know, gifs only support a maximum 256 indices in their colour palette and can support 1/0 transparency.
.png (at a push) can run to 64bits of information per pixels (17million colours) and can assign an entire 8 bit channel to transparency (ie opacity or percentaged transparency). pngs do not use the LZW compression system and instead use a lossless (unlike lossy jpegs) new algorythm that seems very effective.
Unfortunately M$ are not too good at showing alpha channeled transparent pngs in IE (1/0 trans is ok) - all fine in Moz though.

.png (and animated .mng) are thus a much better image format than gifs.

GD versions prior to GD1.6.5 should support writing gifs. As far as I know, reading gifs is certainly available to 1.8 or so (though I seem to remember Thomas Boutell stating that read support existed in at least one of the 2/2+ builds as the patent is a little washy in respect to reading - probably because things like browsers need to read them and wouldn't pay).

There are scriptlets available that *cough* patch GD to allow read/write *cough* (though I cannot due to TOS tell you more and should warn you that the patent infringement onus might bear upon you if your application uses a *cough* patch)

Really really really - the best idea is to spread the word about the all glorious png (pronounced ping) format as it is so much more useful.