Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: GD and GIF

  1. #1
    Regular Coder
    Join Date
    Dec 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    GD and GIF

    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!
    seldom ruined but by myself

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,108
    Thanks
    11
    Thanked 101 Times in 99 Posts
    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.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    Regular Coder
    Join Date
    Dec 2002
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well that was some kinda answer!!

    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.
    seldom ruined but by myself

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •