This package contains a pair of command-line utilites for translating between bitmap images (JPEG, PNG, GIF, Targa, BMP, etc.) and PostScript files. It requires Python (version 2.2 or higher) and the Python Imaging Library.

Download the latest release: 1.0

imgtops

imgtops takes bitmap images (in almost any common format) and turns them into Encapsulated PostScript files. It uses PostScript Level 2 and 3 features in order to minimize the size of the output files without reducing image quality. More information on how this is done is available here.

% ls -l test.gif
-rw-------    2 dougz    dougz       24893 Jan 30 19:25 test.gif
% imgtops test.gif > output.eps
processing [test.gif]...
% ls -l output.eps 
-rw-------    1 dougz    dougz       44122 Feb 22 20:37 output.eps

Here's the same task, using the pnmtops utility of Netpbm:

% giftopnm test.gif | pnmtops -noturn > output-pnmtops.eps
pnmtops: writing color PostScript...
% ls -l output-pnmtops.eps
-rw-------    1 dougz    dougz      444608 Feb 22 20:38 output-pnmtops.eps
%
Note that imgtops's output file is 1/10 the size of netpbm's. The savings aren't always this dramatic, but they're usually significant.

imgtops also features a batch mode for converting multiple images at once:

% ls  
bw.jpg  cmyk.tif  color.jpg  color2.jpg  flower.jpg
gif.gif gif2.gif  png24.png  png8.png
% imgtops -b *
processing [bw.jpg]...
processing [cmyk.tif]...
processing [color.jpg]...
processing [color2.jpg]...
processing [flower.jpg]...
processing [gif.gif]...
processing [gif2.gif]...
processing [png24.png]...
processing [png8.png]...
% ls *.ps
bw.ps  cmyk.ps  color.ps  color2.ps  flower.ps
gif.ps gif2.ps  png24.ps  png8.ps
imgtops can optionally use PostScript Level 3 features to reduce the output size even more:
% imgtops cmyk.tif > level2.ps
processing [cmyk.tif]...
% imgtops -3 cmyk.tif > level3.ps
processing [cmyk.tif]...
% ll lev*ps
-rw-------    1 dougz    dougz      172888 Feb 22 20:52 level2.ps
-rw-------    1 dougz    dougz       61702 Feb 22 20:52 level3.ps

epstoimg

epstoimg uses the free Ghostscript PostScript interpreter to turn PS and EPS files into bitmap images. It is similar to the commonly available pstoimg utility. I think it has a saner set of command-line options, it automatically handles multipage documents, and I think the output is nicer, especially for text:

epstoimg pstoimg -antialias -aaliastext


Doug Zongker
dzongker@users.sourceforge.net
4 September 2003 SourceForge.net Logo