Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Webmaster's Domain | Fugitive From Justice


Webmaster's Domain | Fugitive From Justice (Web Techniques, Dec 1999)

Fugitive From Justice

According to the Unisys Corporation, I'm a fugitive from justice. A rogue Webmaster. A flaunter of national and international treaties. My Web site uses (gasp!) GIF images.

Chances are that you're a fugitive, too.

Most readers have heard about the GIF controversy. During the early days of the Web, the CompuServe graphics interchange format (GIF) became the dominant way to put graphics on Web pages. This was due in part to the GIF format's ability to compress 256-color graphics in a lossless fashion, making the resulting files small and easy to transport. A more important factor in GIF's rise to fame, however, was CompuServe's forward-thinking publication of the GIF format as an open standard, and the wide availability of GIF encoder and decoder example code. Support for GIF was built in to many commercial products, and to a large number of freeware products, too. Then Marc Andreessen built GIF decoding and rendering in to Mosaic, and the rest is history.

A New Year's Surprise

At first the GIF story looked like a triumph for the nascent Open Source movement. Then the other shoe dropped. The Unisys Corporation, which holds the patent on the Lempel-Ziv Welch (LZW) compression algorithm, noticed that CompuServe's published GIF specification was built around the LZW algorithm. CompuServe, unaware that the widely published LZW compression system was under patent protection, had failed to obtain a license for the use of this technology. Not good. Unisys' lawyers talked to CompuServe's lawyers, and an agreement was hammered out, the results of which were announced in a press release issued on New Year's day, 1995. Henceforth, all vendors of GIF-generating software would have to obtain a license from Unisys for the use of the LZW algorithm under terms that would provide Unisys with a royalty on all copies of the software sold.

The wording of the initial press release made it sound as if Web browsers and other GIF viewing software were also covered under these terms (a difficult condition to meet, since browsers were then, as now, being distributed for free). Pandemonium erupted. However, a subsequent press release issued in the second week of January clarified the situation. Unisys would not enforce its patent against software designed for GIF viewing, such as browsers, nor would there ever be a restriction on using GIF images. Only software that encoded GIF images was liable.

The Adobes, Corels, and Microsofts of the software world bought licenses for their graphics software. However, Open Source developers were left in a quandary. When Open Source developers contacted Unisys seeking licenses for the use of the GIF encoding algorithm, they were either refused outright, or offered licensing terms that were financially unmanageable. Unisys is openly hostile to Open Source -- understandably so, as there's no practical way to collect royalties on freeware products. Freeware may even cut into the sales of royalty-generating products.

I was indirectly affected by this controversy. Some time earlier I had written a Perl module called GD.pm that interfaces to Thomas Boutell's libgd library. libgd allows CGI scripts and other programs to create GIF images on the fly. With GD.pm, Perl scripts could do that, too. Together, libgd and GD.pm had become extremely widely used on the Web to generate dynamic maps, diagrams, charts, and other graphics. Would I be forced to withdraw GD.pm from circulation?

The Open Source Community Replies

Because Unisys had blocked other alternatives, the Open Source community sidestepped the issue by taking two parallel development paths. The short-term path was to develop GIF encoders that didn't use the LZW algorithm. Toshio Kuratomi released libungif, a port of Eric Raymond's libgif library that generated uncompressed GIFs. Later, Thomas Boutell released a new version of libgd which used run-length compression instead of the LZW algorithm.

Although technically neither of these libraries uses LZW compression, they both rely on tricks to fool the GIF LZW decoder into reading the images they generate. Hence lawyers could argue that these libraries are still acting as LZW encoders in violation of the LZW patent; the fact that they are severely broken encoders is irrelevant. Despite the legal uncertainties, the Open Source community adopted a "don't ask, don't tell" attitude, and GIF-encoding software programs, including GD.pm, continued to flourish as freeware products.

The longer-term path was to replace the GIF format entirely with a graphics format unencumbered by intellectual property restrictions. The Joint Photographic Experts Group had already released the JPEG format into the public domain, providing a mechanism to create and distribute full-color photographs using a lossy compression algorithm. The niche to fill was a lossless format suitable for diagrams, business graphics, and other images that don't need the color depth of photographs. Hence PNG, the Portable Network Graphics standard, was born.

Within months of the joint Unisys/CompuServe announcement, a coalition of software developers led by Thomas Boutell began work on the PNG specification. Within a year, Guy Schnat, Andreas Dilger, and Glenn Randers-Pehrson had developed a reference implementation of PNG embodied in the libpng library, and other Open Source developers had incorporated the library into their graphics products. PNG now enjoys the status of a WWW Consortium "recommendation," and has been blessed by the ISO standards process. The major Web browser vendors also provide grudging support for PNG, the details of which I'll provide later.

PNG does (almost) everything that GIF does, and a few things more. Like GIF, it can compress graphics in a lossless fashion, which it does using the zip algorithm (the same used in the popular gzip compression utility). It supports both transparent backgrounds and progressive display across slow networks. Unlike GIF, PNG can store gamma and chromaticity information to improve display on different platforms, and has an optional alpha channel that lets you create images with partially transparent regions and other special effects. PNG is also more flexible than GIF in the types of images that it can handle. It supports grayscale images, indexed-color images, and even true color, in bit depths ranging from 1 to 16 bits. This means you can use it for images that have more than the 256 colors allowed by the GIF standard, but fewer than the millions used for scanned photographs. Not only does PNG fill the niche occupied by GIF, but it can replace TIFF images in many cases as well.

The one deficiency is that PNG does not support animations the way that the GIF89a format does. At the time the PNG specification was written, the advertising world had not discovered animated banner ads and there was no perceived need for such an extension. Personally, I'd be happy to see a Web free of jittering, dancing graphics; nevertheless, an effort is now under way to create an animated network graphic format called MNG (Multiple-image Network Graphics).

Unisys Strikes Back

This was the status quo until just recently, when two events stirred up the controversy. The first occurred in midsummer 1999 when a well-meaning user of Thomas Boutell's libgd library contacted Unisys in an attempt to determine the licensing status of libgd. Unisys in turn contacted Boutell, and the outcome of the ensuing discussions resulted in libgd being withdrawn from distribution and replaced with a version that generated PNG format files only. Acting preemptively to avoid a telephone call from Unisys' lawyers, I updated GD.pm to make it compatible with the new version of libgd, and disabled its GIF generating facilities. Henceforward CGI scripts that use libgd or GD.pm to generate dynamic graphics will only be able to output PNGs.

It's likely and perhaps inevitable that the same will happen to other Open Source graphics products that read or write GIFs. The maintainers of the popular XV and Image::Magick viewers, as well as the powerful GNU image manipulation program (GIMP), may all soon get that fateful telephone call and be forced to remove support for GIFs.

But this pales in comparison to Unisys' next step, which was to criminalize the possession of GIF images generated by Open Source software. During the last week of August 1999, Unisys announced a new licensing procedure for the LZW algorithm directed not at producers of GIF software, but at users of GIF images. Web sites are now prohibited from using GIF images that may have been generated by nonlicensed software. A Web site that is completely public and does not sell advertising or generate any other commercial activity (something Unisys calls an "Internet Billboard Site") is eligible for a special cut-rate license of $5000 to cover its use of potentially unlicensed GIF images. Other Internet sites, and all intranet sites, must individually negotiate licenses with Unisys.

Think of the implications. There are millions of GIF images in the public domain; all those horizontal rules, fancy borders, bullets, backgrounds, and icons. They've been packaged into online image collections, repackaged into commercial Web-design toolkits, distributed with Web-server software, and in some cases, incorporated into operating system distributions. To comply with the letter of Unisys' requirements, a Webmaster would have to trace each and every GIF image back to its source and verify that it was generated by licensed software. Even an image generated by licensed software becomes contraband if it is once touched by an Open Source product, because the image that gets written to disk is generated by an unlicensed LZW encoder.

To get Unisys off their backs, many Webmasters will pony up the $5000 fee, a prospect that must have Unisys executives salivating in anticipation. I don't know what the licensing fee for commercial sites is, but I imagine that it will be significantly higher. This is not just corporate greed, but a direct attack on Open Source products. Unisys' hostility to Open Source is revealed in a quote reported by Slashdot in an August 31 editorial. Mark Starr, Unisys' general patent and technology counsel, is quoted as saying, "We do not use freeware in our own products as a matter of policy. It could violate someone's license, it could be trash. Anyone who uses freeware does so at their own risk."

I'm saddened to hear that Unisys feels that freeware is trash. I suppose its general counsel doesn't realize that, contrary to his statements, Unisys does indeed take advantage of Open Source. Unisys' network services division distributes a remote network management tool that uses GD.pm to display network status graphics. GD.pm, of course, uses libgd, which in turn uses an unlicensed version of the LZW encoder. Perhaps Unisys should negotiate some site-licensing terms with itself?

Becoming Legal

The simple and morally satisfying response to this latest turn of events is to jettison all GIF images and replace them with PNGs. Several freeware products can ease this transition. For example, the Image::Magick package's "convert" utility lets you interconvert image formats in batch mode. Example 1 shows a pair of commands that first converts all GIF images into PNGs, and then deletes the originals. The next step in the process would be to find all HTML files that refer to GIFs and change the names, a somewhat more difficult process, but one that can be automated easily with a Perl script. An alternative for Apache Web server users would be to create a URL rewriting rule using the mod_rewrite module. This rewriting rule would silently replace requests for "an_image.gif" with "an_image.gif.png"; Example 2 will give you an idea of how this works.

However, there's a problem with the wholesale replacement of GIFs with PNGs. First of all, PNGs don't support animation, so any animation information gets lost in the translation. A more significant problem is that major browser support for PNGs is still spotty, despite the fact that PNG has been a stable standard for years. Support for PNGs appeared in Netscape Navigator only in version 4.04, and in Internet Explorer in version 4.0b1. There are also significant limitations in the browsers' implementation of PNG. I have yet to find a version of Navigator or IE that supports transparency, let alone the more advanced PNG features. Transparent backgrounds appear white. Even the most current version of IE is mystifyingly incapable of displaying stand-alone PNG files. It can display PNGs when they're embedded in <IMG> tags, but it won't display them as an independent document.

Because of these limitations, a site that jettisons its GIFs in favor of PNG risks breaking graphics for a significant number of users. Nevertheless, in the wake of the recent Unisys actions, many sites have begun to do so. No doubt this will put pressure on users to upgrade their browsers, and on browser vendors to upgrade their products' PNG capabilities. As a pervasive Web standard, GIF's days are numbered, killed by the greed of its owner.

Life on the Lam

I haven't paid Unisys my $5000, and I still generate GIF graphics using an older version of GD.pm. This makes me a fugitive from justice. I'm nervously crunching my Web-server logs to see how many visitors would be adversely affected by a switch to PNG, and waiting pensively for the fateful phone call from Unisys' legal department. Will I elude the long arm of the law? Will I pony up the protection money? Or will I kiss my GIFs goodbye?

Stay tuned.

(Get the source code for this article here.)


Lincoln is an M.D. and Ph.D. who designs information systems for the human genome project at Cold Spring Harbor Laboratory in New York. He can be reached at [email protected].


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.