Editing Postscript

It might seem odd to want to edit a postscript file - which is generally an image - via a text interface, but it can be quite useful and is not terribly difficult. It came as a surprise to me when I discovered that postscript is actually human- readable, but except for the image binary sections, it is.

For the example, we'll use the DS9-generated postscript image from the DS9 Tips Page.

To simply remove the colorbar, delete lines 347-393. This is the first image section of the postscript, I identified it as the colorbar by noting that it is much smaller than the other image section. Now we know that DS9 chooses to draw the colorbar first. Lines 333-346 should also be deleted as they are setup commands for the colorbar.

The next - and for me final - step is to tighten the bounding box so that the ps file does not include extra whitespace.

The original bounding box is: %%BoundingBox: 36 226 576 566
I found that the bounding box parameters %%BoundingBox: 120 256 455 555 worked well via a simple process guess-and-check using ghostview.

I found the results to be significantly nicer than the original DS9-generated image.