Graphic File Formats in Grail 0.3


Sun's Tk package currently supports just the image file formats GIF and PPM, which means Grail can only natively display these two image types. Of course, this means that one of the most popular formats, JPEG, cannot be natively displayed in Grail. When Grail encounters an <IMG> tag with a source file in JPEG format, it will display a blank square. When Grail loads a JPEG document, it will eventually consult your .mailcap file to see if you have a helper application that can handle this format.

Through the use of two freeware software distributions, you can expand the universe of file formats that can be displayed inside Grail. One caveat, these packages may be fairly Unix specific, if not in their actual operation, then in their configuration and installation procedures. You'll have to check the package's documentation, or talk to their maintainers for help in building them for your system.

NetPBM is a toolkit for conversion and manipulation of image files. It's pretty useful in it's own right, but in the context of Grail, it opens up the range of images that can be converted to GIF, and thus displayed natively in Grail. However, it doesn't handle JPEG! For that, you can pick up the Independent JPEG Group's JPEG software distribution. This contains programs that will convert JPEG to GIF. Although copyrighted by their various owners, both packages are readily available for free from many anonymous ftp sites. Here are some convenient location within the USA as of 12-Apr-1996:

TBD: should we mirror these on python.org??? Yes!

The latest version of NetPBM that I've been able to find is the 1 March 1994 release. NetPBM is based on Jef Poskanzer's Pbmplus package, which I think is not being maintained anymore. The NetPBM release is a collection of useful enhancements and bug fixes to the last Pbmplus release.

The JPEG Group is, I believe, actively maintaining their distribution. The last time I checked, I downlowed version 6a of their software, which has a release date of 7 February 1996. This should work fine for Grail.

So all you need to do is download, build, and install these two packages on your system someplace. If you've done this kind of thing before, it should't be too hard, although the NetPBM install recommends Imake (blech!). You can build with just Make, but I haven't tried this.

If you haven't done this kind of thing before, I suggest you just try to install the JPEG software. It is easier to install, and gets you the largest return on your investment, most images these days are either GIF or JPEG.

djpeg is the program that Grail uses to convert JPEG format images into GIF for native rendering. Make sure that once installed, the djpeg program is on your executable path (environment variable PATH for you Unix weenies). Grail searches for it in these directories, not on Python's sys.path. If Grail can find it, then JPEG documents and inline images are converted GIF and rendered in viewer windows.