[PostScript] [Usage] [Installation] [at CERN] [at SLAC] [Versions] [Copyright] [Download]


Gifconv - GIF to Postscript conversion

Gifconv reads a GIF (Graphics Interchange Format) image file and converts it to another format: PostScript (or Encapsulated PostScript), PCX (a PC format), PICT (Macintosh), or PPM (Portable PixMap), using the xwpick backend. This is mainly useful because xwpick produces particularly well-behaved and compact PostScript. For the other formats, many other programs do the same job, eg. xv, pbmplus, or netpbm, and in fact these may be used to convert an image to the GIF format that gifconv requires as input.

Gifconv was written by Tim Adye <T.J.Adye@rl.ac.uk>, modelled closely on, and using routines originally from, xwpick 2.21 by Evgeni Chernyaev <chernaev@mx.ihep.su> (xwpick used to be called xpick). Some of this code was also used in the xv-psnewstyle patch. I have modified the xwpick C and Postscript code extensively, so any bugs therein are almost certainly my fault.

Gifconv also uses GIF reading routines based on code by David Koblas.

PostScript Output

Following xwpick, gifconv uses the Lempel-Ziv Welch (LZW) compression algorithm for image encoding in PostScript. This produces very compact files: usually several times smaller than files produced with Run Length Encoding (which is used in xv's compressed Postscript output) and very much smaller than files produced without compression.

Additional compression (compared to, eg., xv) is obtained by using an 85-letter character encoding (! to u), rather than hexadecimal. % characters in the first column are indented by one character to prevent programs that strip Postscript comments (eg. dvips without the -K0 option) from removing these lines.

PostScipt files produced by gifconv automatically understand on what kind of printer they are being printed. On Level 2 PostScript printers the native LZW/ASCII85 decoding filters will be invoked, while on Level 1 printers inline decompression code is executed. Rendering time on Level 2 printers is pretty fast. On Level 1 printers the image rendering is, of course, much slower, but still usually faster than for Run Length Encoded PostScript images.

Usage

gifconv [options...] [<gif-infiles> [<outfile>]]
Standard output is used if only one name is specified, or the outfile is - . If multiple input GIF files are given (3 or more parameters specified), then the output postscript contains each on a separate page.

Possible options are:

-reverse
transfer image to reverse colors
-gray
transfer image to grayscale
-norotate
don't rotate postscript image to fit
-page
include page numbers in postscript
-size sz
encapsulated postscript image size (eg. -size 200 or 100x200). This option is useful for creating an encapsulated postscript image that can nevertheless be printed alone at a reasonable size.
-verbose
display extra GIF decoding information
-format frm
specifies the output format as one of ps, eps, epsi, psrl, gif, pcx, pict, or ppm. The default format is taken from the filetype, or ps for stdout.
The output formats are
ps
A PostScript file with a compressed image. The image is centered, rotated (as long as -norotate is not specified), and scaled to fill the maximum space on a page. This format can be sent directly to a Postscript printer.
eps
An Encapsulated PostScript file with a compressed image, keeping the original dimensions (or that specified with the -size option) and containing a BoundingBox starting at (0,0). It is intended for insertion into other documents (eg. LaTeX, processed with dvips).
epsi
Similar to the eps format, but a black and white device-independent preview image is added to the file. This can be used with text processing packages (eg. Framemaker) to see an approximation of the image on the screen.
psrl
Similar to the ps format, but uses the (usually much less compact) Run Length Encoding (RLE) compression.
gif
Graphics Interchange Format.
pcx
The PCX format is sometimes used on PCs.
pict
The PICT format is used on Macintosh.
ppm
The Portable PixMap format, which is part of the PBM+ library by Jef Poskanzer. Use it and a routine from the PBM+ library if you wish to have the image in a format not mentioned above.

Examples

Single File

gifconv $BFROOT/doc/Images/bfactory-detector.gif bfactory-detector.eps
For this particular image, the resultant Encapsulated Postscript file is 2.8 times smaller than that produced by xv (with xv's compress option).

Multiple Files

Given GIF files scan01.gif, scan02.gif, and scan03.gif (and no others in the current directory)
gifconv -page -norotate scan*.gif scan.ps
creates a single file, scan.ps, containing each image on a separate, numbered, page. -norotate is specified to prevent the images being rotated to fit each page.

Installation

Gifconv has been successfully compiled and run on Digital Unix (Alpha/OSF) 4.0, HP-UX 10.20, Sun Solaris 5.5, IBM RS6000 AIX 4.1 and 4.2, and OpenVMS 6.2 (VAX and Alpha).

Download the gifconv source code distribution and unpack it with

gzip -dc gifconv-2.21b.tar.gz | tar xf -
cd gifconv-2.21b
Then build gifconv
xmkmf     # (or use imake directly, since gifconv doesn't require X11 libs)
make
If xmkmf/imake aren't available, copy Makefile.std to Makefile, check the options, and just run
make gifconv
The distribution still contains xwpick, which can be built as described in 0INSTALL. Makefile.std builds both xwpick and gifconv, while Imakefile makes just gifconv.

Installation by patching xwpick (not yet available)

First unpack the xwpick 2.21 distribution and move the gifconv-2.21b.patch file into that directory. Then

cd xwpick-2.21
patch < gifconv-2.21b.patch
This will apply all the changes, as well as adding new files. Then make gifconv and/or xwpick as described above.

Installation at CERN

Gifconv is installed on AFS at CERN in
/afs/cern.ch/user/a/adye/bin/gifconv
To select an architecture other than your current one, use .hp_ux102/bin, .alpha_dux40/bin, or .rs_aix41/bin in place of bin in the path.

Installation at SLAC

Gifconv is installed on AFS at SLAC in
/afs/slac.stanford.edu/u/ec/adye/bin.arch/gifconv
To select an architecture other than your current one, use bin.OSF1, bin.aix6000, bin.hpux10, or bin.sun5 in place of bin.arch in the path.

Version History

Gifconv versions:-
24 Jan 97, 2.21a
Initial version based on xwpick 2.21. Also includes some minor improvements to xwpick 2.21 (making 2.21a), removing the hardcoded limit (4096) on the width of the image and adding the -size option.
22 May 98, 2.21b
Added multiple GIF->PS conversion (using code from Jean-Damien Durand). Added -norotate and -page options. Much tidying up, including some const-correctness.
6 Jun 98
If more than one page, then don't make grayscale the default, even if the GIF is grayscale - in case subsequent GIFs are in colour.

Copyright Notices

Gifconv is Copyright 1994, 1996, 1998 by Tim Adye <T.J.Adye@rl.ac.uk>. It includes contributions from Jean-Damien Durand <Jean-Damien.Durand@cern.ch>.

The following copyright restrictions and disclaimers apply also to the gifconv-specific code.

Xwpick is Copyright 1993, 1994 by Evgeni Chernyaev

Permission to use, copy, modify, and distribute this software and its documentation for non-commercial purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice appear in supporting documentation.

This software is provided "as is" without express or implied warranty.

The xwpick author may be contacted via:

Mail:
Evgeni Chernyaev
Institute for High Energy Physics
142284 Protvino, Moscow region
Russia
E-mail:
chernaev@mx.ihep.su

gifread is Copyright 1990, David Koblas. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.

HTML 3.2 Checked... Best viewed with ANY browser! http://hepwww.rl.ac.uk/Delphi/Adye/gifconv.html last modified 20th July 1999 by
Tim Adye, <T.J.Adye@rl.ac.uk>