Unix tools for Image Manipulation

Editing, converting

Tiff, gif, jpeg & Co...


is here.

Xpain, Tpain, ...

Once upon a time Rudi and myself decided to create the ultimate image manipulation tool. Portable, free, GUI-interface AND ascii-interface, scripting language... Unfortunately we both were postscript enthusiasts and based our code on a stack language and reversed polisch notation. The thing was called xpain. It could read and write images in different formats and run several home-brewed algorithms. We had no idea, how to add a GUI. A year later, I stumbled into Tcl/Tk and discovered a very elegant new scripting language and a nifty GUI. The result was called tpain. It could do everything that xpain could, but also had a miniature menu-bar and a file-select box, to load images with. It also required a complete Tcl installation with thousands of scripts everywhere.


John Bradley's Xv is more an image viewer and allows a few basic manipulations. Did you ever drag with the middle mouse button while holding down the shift key? Very useful. It is not all I need, but it is brilliant and it works very well. Online documentation for Xv is available in our source tree


The Gimp

Yesterday I discovered gimp. Peter and Spencer had the same dream we had, but started with a Motif-GUI rather than a scripting language. Their result is usable. Ours was not. Gimp needs lots of shared memory and fingertips with builtin photoshop support. I have both.


Our admins upgraded to the Netscape 2.0 the other week. So, sooner or later I found an animated button on someone's page. This was astonishing, because I have java and javascript disabled. So I looked closer and saw that it was just a GIF file. After a bit of reverse engineering, I came up with a small program to glue a list of gif images into an animation: gifanim.c. Note that Netscape replaces the transparent color of animated GIFs with white. Btw, my favorite method of creating transparent GIFs is with ppmtogif from pbmtools.


The author of this package was Jef Poskanzer, but as other maintainers added more tools, the package changed its name into Pbmplus and then NetPBM.


Postscript, postscript & postscript...


Postscript language level 2 supports jpeg decompression. All you need is a short prolog, followed by a simple hex, ascii85, or plain copy of the entire jpeg file. This can be done by a shell script called jpeg2ps. It also supports gamma correction, scaling, and best fit.


Angus Duggan's pstops tools interpret postscript files (aided by structuring conventions), to extract individual pages, to shuffle them, to perform linear transformations on them and to put them back on sheets of paper, n pages per sheet, if you like. If you want to learn another cryptic command-line-interface, here you are.


Feed any postscript font, and see how good it is. An ugly bitmap may hide everywhere. Even inside your favorite type 1 font. prfont48.ps.gz shows you the truth. It also contains an enhanced iso-latin-1 encoding vector.


Postscript engines can select different paper sizes with the a4, a3, ... commands. These procedures are machine dependent. Now, this is a hack: The code fragments in setpagesize.ps.gz demonstrate how the a4 procedure can be disassembled, modified and reassembled into a procedure that sets your favourite size. I exercised this with ghostscript and HP DesignJet 650C. A primitive postscript disassembler is included.