[Image-SIG] PIL

Eric S. Raymond esr@snark.thyrsus.com
Wed, 8 Jul 1998 18:41:04 -0400

For some years I have maintained GIFLIB, a C library and utility
toolkit for performing various slice and dice operations on raster 
images.  See http://www.tuxedo.org/~esr/giflib for details.  Recently,
however, it became clear that Unisys's position on the LZW patent
makes continued distribution of this library too risky for me and for
its users.

I want to drop supporting it, but I don't want to do so without
leaving GIFLIB users some alternative supporting the toolkit
capabilities.  My original thought was to try to rescue the C code by
teaching it to speak PNG.

I announced this to a group that included Guido.  He steered me to
PIL.  PIL is very impressive -- so much so that I think it will enable
me to officially declare the utilities in GIFLIB obsolete (but not the
library; that's a separate issue to which I'll return below).

A couple of documentation bugs:

  On the index page, `Enhance' is spelled `Enchance'.

  The `ImageFont' page is missing (File Not Found).

  On the page describing the `Image' class, the `fromstring',
`tostring', and `putdata'  methods are listed but not described.

  The description of the resize method gave me pause until I guessed
that the size argument is a tuple.  Don't make the reader guess;
specify the argument semantics there.

  You should specify the angular units in the `rotate' method.
Degrees, radians, or grads? :-)

  I think the PIL documentation's use of the term `band' is rather
unfortunate.  To a native English speaker, the term `band' applied to
a graphic has a strong primary meaning which is different from PIL's;
that of a stripe or region (especially a horizontal one) extending the
full width of the image.  
   I recommend that you substitute the for `band' the term `channel',
which is well-established in exactly this sense for RGB images.  It is
also the term used by the PNG folks and others in the graphics
community (notably the author of the "Graphics File Formats"

Functional suggestions:

Allow an optional argument in show() specifying the viewer command
to use.

There are aome places where PIL falls short of being a complete
replacement for the GIFLIB utilities:

1. No ability to display images using (a) the Borland BGI driver,
(b) an Epson printer, (c) a Hercules graphics card.  I think we
can safely write these off as obsolete, however.

2. No ability to handle RLE (Utah raster toolkit) images.  I'm not
too worried about this, either.  Is anybody still using it?

3. No equivalent of the gifbg, gifwedge, and gifcolor test pattern
   generators.  These would probably be trivial to write.

4. (Serious) I see no way to overlay text on an image.  I can supply a
clean 8x8 font and code for ImageDraw to overlay messages on an image
using it.  Later this method could be extended to support fonts from
an X font server.  Is this sort of thing what the missing ImageFont
module is about?

5. (Serious) There's no equivalent of the `clip complement' feature in
giflclip.  Here's the GIF description:

     Complement. This removes horizontal and/or vertical bands of the
     image. For example `-c -i 638 3 658 13' would remove a horizontal
     band 11 pixels deep beginning at raster line 3, and a vertical
     band 21 pixels right beginning at pixel 658.

     This is useful more often than you'd think....

6. I see no standard function or method for composing multiple images into a
multi-file image in formats like GIF.  (The gifovly utility in GIFLIB
does this.)

7. (Serious) There doesn't seem to be any way to specify interlacing or the 
screen size on GIF output (GIFLIB's gifinter and gifpos utilities).

8. No utility to section an image into tiles (gifburst).

9. No equivalent of my icon2gif utility (see 


).  Never mind, this is very GIF-specific.

If I hack in some of these things, can I stimulate a PIL release to
replace GIFLIB?
		<a href="http://www.tuxedo.org/~esr">Eric S. Raymond</a>

.. a government and its agents are under no general duty to 
provide public services, such as police protection, to any 
particular individual citizen...
        -- Warren v. District of Columbia, 444 A.2d 1 (D.C. App.181)