GIF Support Returns to GD
g_adams27 writes "Legions of geeks and developers owe a debt of gratitude to Tom Boutell and his "gd" library, which powers the drawing and graphic-generating tools used by dozens of open-source projects. And now, with the expiration of the last Unisys patent on the GIF format, support for GIFs has finally been reinserted in gd. The GIF/PNG/MNG wars may continue, but having more options is good!"
var_dump(gd_info());
Some nice soul posted a comment on PHP.net that has what appears to be a great function that does the same thing, but could be used in install scripts and hacked to get it working the way you want:
The dangers of knowledge trigger emotional distress in human beings.
I'm going to ask a lawyer to see how a gif/png can violate my rights on the internet in a second. Thanks for the information slashdot editor :)
I like muppets.
I know I didn't.
I've been looking forward to this for a while. It's certainly been annoying to have a common web graphics format protected by patents, limiting its usability by free software. Now if only the same could be done with some other file formats that we might find useful...
It would be nice to have this story filed under PHP as a subtopic, authors!
The dangers of knowledge trigger emotional distress in human beings.
but I'd rather see widespread adoption of PNG
Join Team Mozilla #38050 Folding@home
I bet nobody in Unisys (at least nobody high up) even knew about this happening ... otherwise they would have realized they weren't making money in the last year and put it in the public domain and made a press release etc.
Shows you that a corporation like Unisys isn't dynamic. RSA on the other hand, was making money off their patent and decided that there's value in releasing it into the public domain prior to the patent expiration date.
Beware of Geeks bare in GIF's.
You missed by a minute, buddy. Need to be a bit quicker with the Ctrl+R. Or get a liff.
The only thing gif does better than png is animation. Okay, on some rare occasions, gif compresses better. But most of the time, you have no reason to use gif instead of png.
GIFs are great for animations, but I really do prefer PNGs at this point. While it really isn't that big of a deal, PNGs are simply smaller and look better. If we could just get Microsoft to fix Internet Explorer, we'd have a new defacto standard for all non-photographic images.
Javascript + Nintendo DSi = DSiCade
Doesn't IBM still have patent time remaining on GIF and what about that Sonny Bono thingy? couldn't Unisys come back and get the patent again?
In every way, except for animation. And before you say something about IE, PNG8 works fine in IE, and gives you everything that GIF does (minus animation).
It used to rely on a very old gd lib for gif support.
perl -e 'printf("%x!\n",49153)'
Can you show me a mainstream, modern browser that doesn't understand both GIF and PNG?
Only funny if you know how it's pronounced.
The usual crowd of nincompoop Slashbots are going to crow "They should just leave it out! Everyone should use PNG anyway!!"
... GIF is still the only available option.
Let me answer that in advance by reminding everyone that GIF is a useful format. Everything can read it and display it. It's been around for two decades and is now a completely open and unencumbered standard.
And let's not forget that when you need to display an image that is non-lossy, and supports transparency, and displays properly in Internet Explorer (shame on you for using Internet Explorer in the first place, but we'll accept that a lot of people still do)
Tired of FB/Google censorship? Visit UNCENSORED!
Are we sure M$ doesn't have some patent now that could cause some trouble on this. At their rate of getting patents on technology/already-dev-tech they will have a patent on everything.
Evolution or ID?
The only remaining use of the GIF is for animated images, something GD is bad at producing anyways.
Then people always like to say stupid shit like "Well IE has bad support for png". While true,it doesn't stop pngs from doing everything a gif does(minus animation). IE may not support the alpha channel correctly, but it still has the full-on transparency of GIF's.
So who cares? Let gifs fucking die, we don't need them anymore.
Any browser which doesn't support PNG is also not going to deal well with the rest of basicly all websites, or anything else on the modern internet.
IE displays PNG's properly, with transparency, and it's still non-lossy. IE only doesnt properly support the alpha channel of PNG's.
why are you complaining?
at least I didn't "a href" to any bare geek gif's...
Oh, I forgot to tell you guys about my patent for "any process used to display a visual image on a screen in a digital format"
TODO: come up with a clever sig
Yes. When I first worked on an earlier layout (archived here) of my personal site, some people still had Netscape 4.7 and IE 4.01 browsers, and I made sure the site's indexed PNG images still looked OK. But now that Google Zeitgeist indicates that just about everybody's on 6.x, I frankly don't care about graceful degradation for Netscape 4.x anymore.
I've never known anyone to not spell it out.. and yet you say "for clarity".. geez, do you really need that extra sixteenth-second it takes to say "G I F" instead of "GIFF"?
-- 'The' Lord and Master Bitman On High, Master Of All
Soon to return to us, rotating GIFs on _every_ web site! The internet will once again be jumping with life!
Patents = Illogical
Nobody asked about, nor gives a shit about your opinion in the first place.
Hope that answers your answer.
Could anyone on the know tell the rest of us why is it that digital cameras choose JPG as the compressed format instead of PNG ? Looks to me like PNG would typically provide better image resolution for a similar filesize. Maybe I am wrong. And also, is GIF an option now that it is free again ?
Well, I wouldn't say the problem is totally user-error. I'd say it's about 2/3 crappy compression implementation in software, and user laziness on trying to get around it. Honestly, most people don't _know_ any better, and why _should_ they, really? If a _program_ like pngout can compress a PNG so much better, there's NO reason that functionality shouldn't be built into every bit of software that creates PNGs. At the very least, let the program call it externally for compressing at the end. The other problem with PNG-creating software is the 8/24-bit palette difference - the software should know to drop the palette down to 8-bit if that's all that's needed. Aren't computers supposed to make things _easier_ with automation? Ugh.
He'd walk up and down the aisles of cubes saying "When are we gonna get some G.D. GIF support!?!"
And now he has his GD GIF support. It's about time.
The Raging Tech - an IT professional's take on love, life, gaming, tv, movies, technology, entrepreneurial woe, and blog
that IE5 and IE6 together account for just over 80% of the market [w3schools.com].
"The statistics above are extracted from W3Schools' log-files." The fact that 14.0 percent of W3Schools visitors run the Gecko engine doesn't mean that 14.0 percent of W3Schools visitors run the Gecko engine. Most people who visit W3Schools are involved with web development, and I speculate that web developers are more likely to use a web browser other than the one included with the most popular home PC operating system than a member of the general population.
Google Zeitgeist tells a different story: Based on hits to Google, a much more general interest web site than W3Schools, the lavender line (representing Gecko) is just now getting ready to cross the overlapping orange and blue lines (IE 5.0 and IE 5.5 respectively). Thus, in the general population, one would expect about as many IE 5.0 users and as many IE 5.5 users as Gecko users, that is, twice as many IE 5.x users as Gecko users.
They're slipping!
Call me when they have slipped, that is, when IE 6's share has dropped by at least ten percent. Until then, a general interest web site needs to cater at least to the vast majority of installed user agents, which are IE 5.5 and 6 for Windows.
While it's possible you are correct, it seems also at least as feasible that they were making money from licenses. In that case, they'd have ha dto give up the revenues from the final year or two, or face legal action by licensees. Regarless of the merits of such cases, it probably would have cost more to fight the battles than they made from licenses. Since they were off most peoples' radar screens, they simply chose to keep the status quo. After all, it was making money!
IANAL, NDIPOOTN.
IBM has a patent on Sonny Bono?
Good idea. Maybe that keeps anyone else from making copies.
Gee, or maybe the big commercial companies actually PAID for a license to use it?
:P
Use your brain, it's there for a reason
Joseph?
[There. That should earn me some karma if the recent Flash flame war is anything to go by.]
Drill baby drill - on Mars
which of those does 8-bit PNG not meet?
Animation. IE cannot display 8-bit MNG, and neither can recent Mozilla.
Now, IE has trouble with 24bit color PNG with transparency, but that's not something GIF is capable of.
GIF is capable of displaying more than 256 colors through a hack on its animation scheme. Draw the first 256 colors, draw 255 additional colors in each subsequent frame, and put the frames in combine mode. One can get to 9- or 10-bit color rather easily this way.
All of this talk about IE, Photoshop, and "pngcrush" just shows that PNG is still not living up as totally suitable replacement for GIF.
PNG seems to be a good example of the second-system effect, where a simple implementation is replaced by "elephantine feature-laden monstrosity", that took a long time to develop, and is difficult to implement correctly. When the largest graphics companies, Adobe & Macromedia, have problems, you have to wonder.
Not that PNG doesn't have its uses, but if the goal was to create a patent-free replacement, it would have been a lot quicker and easier to come up with a "GIF2" rather than the be-all-end-all replacement. Anyway, it shouldn't come as a shock that people lived with the GIF patent for many years, and that PNG will probably never fully replace GIF. Just something for the "Burn All GIFs" crowd to consider.
Business. Numbers. Money. People. Computer World.
It's nice having choices, but don't think I'll be using GIF. PNG is better and enough browsers support it, basically.
John Kerry is a Joke!
gd is SLOW when rescaling images. out of all the libs i tested, imlib2 was the fastest by far. imlib2 scales all my images on my personal photo album on-the-fly and the processor usage is never an issue.
Of course you didn't - most people didn't give a damn except those bozos who decorated their Web sites with those little stupid anti-GIF icons.
Sure, there are some situations where not using GIFs was/is appropriate or desirable (for example where other formats do a better job), but not using it just because it was patented is silly.
Unless you know the business internals and license agreements of those companies, you have no idea whether they respected the patents or not. However, all major graphics program vendors (Adobe, JASC, etc.) have LICENSED the gif compression algorithm, and used it in their programs. Those who paid to use those programs have the right to create gifs.
These commercial softwares did not disrespect "IP-rights," they meticulously followed the law by doing exactly what's required to use the patented algorithm. They showed respect for the patent by paying to use the algorithm. Free software respected the same rights by not using what they hadn't paid to use (because they either couldn't or weren't willing to).
-Dan
I know this is off-topic, but why is it that if I save a PNG file with a resolution of something like 300 pixels/inch, and then re-open it, it comes back in as 299.999 dpi?
If I save it as 100 pixels/cm, it works fine.
Why is it that other formats can handle both systems, and a relatively new format can't?
I fail to see how this is of any importance.
I am the maverick of Slashdot
I'd like to see an alternative to the (increasingly encumbered) jpeg.
A lossy algorithm for PNG would be perfect. Is there any algorithm which is reasonably good and which isn't patent encumbered into the stratosphere?
That patent expired what, two years ago?
The way they sent out nasty letters to people who implemented GIF-producing algorithms, I would say it was more like a "battalion-of-tanks-at-your-front-door" patent.
Free yourself. Everything else will follow.
This raises my hopes that the library will fully support JPEG2000 as soon as 2020.
These "legions of geeks and developers" are just whiners -- the source was always there. If you needed it, you could do it -- the whole point of the open source, right?
In Soviet Washington the swamp drains you.
Urban legend alert!
PHP supported the use of older GD libraries on Windows, some of which still have the GIF support in them. All PHP had to do was not remove the capability detection they already had.
gd now, with the expiration of the last Unisys patent on the GIF format, support for GIFs has finally been reinserted in gd. The GIF/PNG/MNG wars may continue, but having more options is good!
http://www.trilon.com/xv/index.html
If only we could finally get the next version of John Bradley's late lamented XV now that that patent issue is out of the way.
"Okay, next on the checklist:
LOTS of animated GIFS , or "jifs", or however you say it. I heard a couple of nerds arguing about it sometime. But you want as many of those as possible, especially the rotating kind, those are awesome, man. Nobody gets tired of those..."
"James, the internet is a place where absolutely nothing happens. You need to take advantage of that."
I used to work for a company named Mastersoft, which was acquired by Frame, the makers of Frame Maker (the now-discontinued DTP app); Frame was subsequently acquired by Adobe.
While at Mastersoft, I developed an implementation of a PNG reading and writing library for use in various file format conversion products; these reading and writing libraries were also licensed to OEMs for inclusion in other commercial products, so they're in a lot of places. The libraries I wrote used Jean-Loup Gailly's (sp?) zlib (since I didn't want to reinvent the wheel and debug a compression library), but did not rely on the pnglib reference implementation in any way.
I was very proud of the fact that my libraries were the first commercial implementation of PNG, as far as I can tell. However, due to time constraints and some performance requirements, the compression done by my PNG writer libraries wasn't the best. Specifically, I avoided using any scanline filter type other than Paeth for my PNG writing library; most modern PNG writers will try all 5 filter types on each scanline, and see which compresses the best. My choice had the virtue of saving time in writing a PNG file to disk, but doesn't necessarily produce the smallest PNG files. I also used a relatively small PNG chunk size; since each chunk has some overhead, more chunks means larger PNG files. Lastly, the version of zlib that I used was current as of the drafting of the original PNG specification; subsequent versions of zlib were released which were slightly more efficient, and a few nasty bugs were stomped out.
I don't know if Adobe is using my PNG writing code in Photoshop, but since Adobe purchased the IP of Mastersoft in the Frame acquisition, it's not inconceivable that they used my code rather than writing their own. If they used my code, then it's quite possible that I'm to blame for Photoshop saving out crappy PNG files that are too big.
In my defense, though, I should say that many people did manage to compress existing GIF files using my PNG library (which shipped as part of the Mastersoft File Utilities by Adobe, a product that unfortunately didn't last long); one magazine reviewer specifically used this software suite to convert a bunch of GIFs to PNGs, and concluded that in most cases, the PNGs were indeed smaller.
As soon as you start dealing with non-indexed color images, though, PNG is no better than TIFF. Some folks might incorrectly try to take a 24-bit source image and save as PNG, then take the same source and save as GIF, and will note that the GIF is way smaller -- as it should be, since GIF doesn't support 24 bpp images, whereas PNG does. To save a 24-bit source image as GIF, you have to first reduce the color space and convert to an indexed color image, since that's the only type of image that GIF can store. With PNG, the bit depth of the original is preserved. (And since PNG supports up to 16 bits per channel, and supports up to four channels -- R, G, B, and Alpha -- you can see how a PNG image can get obscenely large. This is where it pays to manage your expectations and understand the features and limitations of the file format.)
Just to clarify, the Mac version of IE has much better PNG support than the Windows version of IE. In fact, Mac IE supports alpha transparency in PNG perfectly. (Even to the point of blending a foreground PNG with alpha transparency with a background graphic!) Too bad Microsoft abandoned IE on the Mac, and even sadder still that the programmers who worked on Mac IE didn't teach a thing or two to their Windows IE counterparts.
Just to clarify... Mac IE displays all PNGs properly, even with alpha channel. Windows IE displays PNGs with indexed transparency properly, but not PNGs with alpha channel transparency.
And yes, I know that Mac IE is discontinued, but it's still a useful browser to test with. It still has many features that its Windows counterpart lacks (such as better PNG support).
And how overall useless it ends up being...
"The patent problems with MP3/AAC were far from the only objections to MP3/AAC. I'm not returning to MP3/AAC now that they're gone - Ogg is simply superior in every reasonable way for my needs. I'd just like Apple & Dell to fix their broken hardware so life is a bit easier. Returning to MP3/AAC isn't going to solve any problems for me, or for most people. "
We were using the old version of GD that did GIFs, but had to re-write some stuff when they dropped it. I'm not going to bother bringing GIF support back since PNG does everything GIF that does.
Xix.
"Everything is adjustable, provided you have the right tools"
It's the Joint Photographic Experts Group. There is a fairly large difference between a photographer and a photograph(ic).
Huh? I would have thought that's exactly what it would mean.
It appeared a typo slipped past even the Preview Button. If one replaces the second "W3Schools visitors" with "any other site's visitors", does my point hold?
I saw a press article menitioning an overall IE drop from 94.5% to 93.5% in the last 6 weeks or so
But does the curve look like Internet Explorer is headed toward sub-80 percent share among the general WWW user population?
is there any specific reason why png couldnt be extended to lossy images, or is this purely a dogmatic issue?
Just a FYI, barring any setbacks the PHP 5.0.1 image extension will again have GIF write support and it's always had GIF read support. Also, keep in mind that PHP bundles its own modified version of the GD library (from boutell), it's even recommended/preferred. Minor versions of PHP don't add new features but this is seen as a worthy exception.
;)
As for the code submitted in this thread, just use function_exists() on a GD2 specific function, such as imagecreatetruecolor(), much more efficient
So, aside from the possible fact that Macromedia has pull, why does Firefox ship without any Flash-blocking features, but with Flash included? It includes image display features, but has animated-GIF-blocking features, and if anything, animated Flash is more annoying than animated GIFs.
May we never see th
I am developing some PHP websites for imode phones. The problem so far was that pictures _have_ to be in GIF format (and under 10k). And as PHP is using GD to generate its pictures, I was screwed. Now, getting my hosting provider to upgrade is another problem. :(
> And now he has his GD GIF support. It's about time.
Err... you were aware that GD has had GIF support in the past, right?
GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
Not only gd has got GIFs...
$ apt-cache show gimp | grep Provides
/usr/lib/gimp/2.0/plug-ins/gif
/usr/lib/gimp/2.0/plug-ins/gifload
Provides: gimp2.0, gimp-nonfree
$ dpkg -L gimp | grep gif
...Debian's GIMP has them too again. In main distribution. Let no one say Debian's GIMP lacks GIFs again =)
50 bytes and 100 bytes is utterly irrelevant; 99% of the wait the user experiences is caused by network latency (which remains the same). Still, since the patent expired there probably aren't any good reasons not to use GIF for this -- except maybe the Feel-good Factor(TM).
HAND.
I'm referring to that last bit about increasing indents. The transparent-GIF-using webmaster could just as easily have a 20x1 transparent GIF called "indent.gif" used only for indentation. Then they could change indentation just as easily as you could. So there. :)
Just to be clear: I'm not arguing that using transparent GIFs is better than CSS, I'm just saying your last argument is based on the unfair assumption that the GIF-user couldn't use a similar trick to class="indent".
HAND.
The Uruguay Round Agreements Act (URAA) did indeed restore US copyrights to a number of foreign works that had become public domain in the USA. Copyright owners who were planning to enforce a restored copyright were supposed to notify any reliance parties. A "reliance party" was a party who had assumed that a URAA-covered work was public domain and who had begun making use of the work prior to the URAA enactment. A copyright holder could tell the Copyright Office that they planned to enforce the copyright. The Office published lists of URAA-covered works with enforced copyrights. When a reliance party found out about a work's URAA copyright enforcement, they had a 12-month period to prepare and to cease making copies of the work, etc. After the 12-month period, the reliance party was required to honor the restored copyright. If a reliance party had produced a derivative work of a URAA-covered work prior to the URAA enactment, they could keep using the derivative work in exchange for paying compensation to the copyright owner. More information on the URAA can be found here (PDF format file.)
The URAA did try to take into account that parties might have started exploiting URAA-covered works prior to the URAA enactment. However, it was still probably a lousy experience if a party was planning to exploit a URAA-covered work on an extended basis or was not counting on paying anything for a derivative work. Hopefully there were no young individuals or hobbyists who were hit by the URAA.
In this case, it appears that it is indeed possible to restore copyright (and possibly patent) protection to a public-domain work. However, exploitation of the work prior to the enactment of the restored protection would not be punishable.
Because it was meant to be lossless-only. To alter this is to fundamentally alter what PNG is meant to do. The spec writers all agreed, that PNG shouldn't be another TIFF. If you want to see what will happen to PNG if you start adding in every compression scheme and ever possible color space (e.g., CMYK, RGB, YCbCr), just take a look at TIFF. TIFF supports both lossy and lossless compression, every conceivable interlacing scheme known to man, and every color space you can think of -- and most TIFF readers only handle a subset of TIFF images because the spec encompasses so much!
The issue isn't precisely one of dogma, it's one of design by intent. The intent was to create a better lossless image format that would replace GIF, and something that did not have the complexities associated with TIFF. The mailing list discussions among the PNG spec developers were very animated, sometimes bordering on flamage, and a few folks suggested things along the lines of what you're suggesting -- and were shot down. If you want to deal with bilevel images specifically, use JBIG. If you want to deal with lossy image compression, you have JPEG and JPEG2000. PNG doesn't need to try and do what those other file formats already do, and better. (Yes, you can store bilevel images in PNG, but specialized bilevel encoding schemes such as Group III/IV Fax and JBIG do a better job in many cases.)
As of June 21, 2004 (when the page was updated) the Free Software Foundation seems to consider the GIF format to be patent-encumbered. They say that the IBM patent would be an issue even if the Unisys patent was not an issue. Also, it is said that the IBM patent in the USA will expire on August 11, 2006. The FSF has said that they have not been able to search every patent database for every country (they have searched in the USA, Japan, Canada, and the European Union so far.) It is possible that there are additional patents that have not been found yet.
Interestingly, the FSF says that the patents for Unisys and IBM only covered LZW compression and not LZW decompression.
FWIW, if you actually read the article that you linked to, it's pretty clear that Photoshop is simply pre-filtering the image before writing it out as a GIF or PNG. The goal is to pre-filter/pre-process the image so that the lossless compression in GIF or PNG can more efficiently do its job.
This isn't a hack to GIF or PNG; rather, this is a pre-processing step to reduce the amount of actual information in the image, thereby making it more compressible. You could do something similar by JPEG-compressing an image at a lower quality setting, then re-loading it and saving the resulting bitmap as a GIF or PNG.