O, what a picture -

Image manipulation for Crystallographers

How to save your favorite images for posterity via screen capture.

This document is a quick guide to making nice pictures from images of molecules on the screen. Although aimed at workers at BMC, Uppsala, most of the information is generally relevant. It covers copies from local printers, photographic prints and slides, and maybe web graphics too.

You can also see some overheads that will be used in a talk, and these link to a document that covers digital imaging in a more general way.

I) Digital copying

First you need to capture the screen image with a grab tool, such as 'snapshot' on the SGIs, 'xv', 'imagemagick' or The GIMP. These all allow you to select an area of the screen that will get dumped to a file. The details of mouse operation differ, but the end result is always a raw image file on disk. Snapshot always gives an SGI-RGB format file, xv, GIMP and imagemagick give a choice. More tedious, explicit instructions appear later in this document.

The grabbed image can now be modified (cropped, rotated, given text, or coloured) by an image manipulator like 'Adobe Photoshop' on the macs, 'showcase' or 'imgworks' on the SGIs, 'imagemagick' or 'gimp' on the alphas. The commonest operation I perform is to increase the saturation to give brighter, happier, less tasteful colours. Photoshop is great, but requires transfer to a mac and is subject to the limits of memory and disk on most of those machines. The SGI tools are also good, but we don't have many SGIs left. Imagemagick is a mature and stable suite of programs (eg 'display'), but has an amazingly dumb interface where graphical windows pop up to allow you to type in a single value and then disappear again. The Gimp is now installed on many machines, and works well. There is even good documentation. Showcase is more of a layout tool than a manipulator, but is still quite useful. Imgworks is very good for adjusting levels, but cannot change the content of an image by adding text or line drawing.

Once you are happy with the touched-up image, comes the decision on what format to save it as. This is bewildering, but the main choices are :

GIF - A classic format. Lossless compression is excellent for molecular graphics, and blocks of a few pure colours, but bad for complex real images, because of the limit of 256 colours that can be used. Use for simple images on the web.

TIFF - Losslessly-compressible format like GIF, but not quite so widely readable. Popular in the FAX world, and with scanners. There is no colour compression, so this is the format of choice for maximum information fidelity. The penalty is greater file size.

JPEG - Good for photographic images, bad for line art and object graphics. Uses a very clever and efficient algorithm to smooth out small or gradual colour and intensity changes to give enormous (but lossy) compression without damaging the overall impression of the image. Colour depth is enormous. JPEG is not good or efficient with large blocks of single colours or with text. You choose the degree of compression according to how much quality you can afford to lose. Use for photographic images on the web.

RGB - A misleading name used by SGI for their uncompressed pixmapped images. No compression, no loss, no space left on disk.

TARGA - A simple, uncompressible bitmap format similar to RGB.

PICT - A Macintosh format. Good compression for line/block art, but it can be hard to convert once it's left the mac.

postscript - Used mostly for printing, and files tend to be enormous. Tries to store as vector data with fill commands, but can resort to bitmaps. They can in principle be read by the image manipulation programs, but they should really be considered a finally product en route to the printer, not as a storage form, especially since our UNIX installations seem to be unable to read them.

Most big programs can read all these formats, but if your favorite can't then you can convert with one of the others, or with specialised filters, such as 'imconv' or 'convert'.

Here are some statistics for images sizes in different formats :

1000x1000 image
(1 megapixel)
Simple Image

Complex Image

TIFF3000 KB3000 KB
TIFF (LZW)25 KB2000 KB

And here is an image that shows the nature of the degradation of GIF and JPEG formats (slightly exagerated). If you could view this TIFF image directly with you browser, then we wouldn't need the other formats, and there wouldn't be a problem to illustrate. As it is, you may need to download the image to disk, and then view it with some external program. If you are lucky, this is already linked in to your browser as a plug-in. See http://xray.bmc.uu.se/markh/notes/howto/fig3_all_small.tiff

Then you want to print the file. Ultimately, printers only really understand postscript, but the drivers may secretly convert other formats for you. If you have a postscript file, then just print with the command 'lp filename.ps'

Otherwise a quick way to print is to read into netscape and ask it to print for you.

Pictures for publication

When pictures are published in a journal, there is a much more limited colour range available than when you view them on the screen or use a nice ink-jet printer. If you send the journal nice bright colours, they will map them to the nearest dull, printable colours, and you will be disappointed. There is not so much you can do about this, except pre-disappoint yourself by choosing your own selection of dull colours when you create the image. This you can do by using Photoshop's 'gamut warning' facility in CMYK mode. CMYK stands for Cyan, Magenta, Yellow, blacK, and is an alternative to RGB and indexing as a way of expressing colours. It is dependent on the printing medium, so before changing mode to CMYK, you must first specify the printing conditions that your publisher will be using. "Euro_standard Coated" is the default for european publishers. Having done this, 'gamut warning' will display unprintable colours as grey, so that you can see which regions to redo.To see a map of which colours can be printed, goto http://www.rapidgraphics.com/faq_gamut.html


Use xv to grab as follows : run the program by typing 'xv', look at the pretty logo and press the right mouse button to get a more useful window. Select 'grab', which gives a grab window from which you again select 'grab'. Then select an area by dragging the left mouse button. On release, a window containing your selected area pops up. Select 'save' in the original menu window to write this out to a file. When doing the grab, you have a choice of setting a delay before the mouse becomes active for selecting the area, so that you can for example close overlying windows before the save. A beep lets you know when the mouse is ready to be used for the select. Imagemagick is a suite of programs, and it is 'display' which can be used to grab from the screen. It is used very similarly to xv, except that the left mouse button is used to select. Snapshot is non-intuitive, but does work. After invoking with 'snapshot', an unhelpful little icon pops up in a random but irritating place. <Alt-F7> allows you to move it away from your picture with the left mouse button. Then you move the cursor over the icon and hold <shift> without any mouse button, at which point you can select an area with the left mouse button, if you hang on to the shift key. Once selected by dropping the mouse button, the bitmap can be saved using the menu items that appear when the icon is stabbed with mouse left.

Availability of programs :

gere :  alpha           xv, gimp, imconv
capo :  alpha           xv, imagemagick
onyx :  alpha           xv, imagemagick
pluto : sgi             gimp, snapshot, imgworks, showcase, and much more
Example images and their biographies can be found in a separate document.

II) Photography

Apparently people here are fond of using the automatic meter in the camera to determine the exposures for photographing the screens, despite often having good education in physics. Sadly, their pictures come out just fine. This is sad because the recording of each pixel from the screen on the film is independent of what all the other pixels are up to, whereas the meter reading is an average for all the pixels visible to the camera. Thus, the more pixels switched on, the higher the meter reading, and the shorter the exposure given, despite the fact that each pixel still requires the same exposure for its little spot on the film. Average meter readings work fine for space-filling models, or with coloured backgrounds, but not for a few bright vectors against a black background, where the meter still tries to do its job of producing an average 18% reflectance image, resulting in an ugly grey background. So why do people get away with it ? Probably because they bracket their exposures, and perhaps still have less than optimal colour saturation. Plus the human eye has trouble seeing very thin lines, even if they are as bright as wider lines, so they benefit from being overexposed. Anyway, if you're not happy with your photographs, or haven't yet taken any, you might like to know how I do it.

For each screen I have a standard hardware setting, on the Alphas this means noting the numeric brightness and contrast values, and on the SGIs dialing up the brightness so that the background just remains black. Then I make sure that the brightest vectors in my image are as bright as the software allows, which for example means not having the clipping plane too far forward of the front-most atom. Then I use a standard exposure, however complex the image.

For example, Pluto needs 1 second at f5.6 with ISO 100 film. This I have found by trial and error, but metering a plain grey screen gives a good starting point. 0.5 secs at f4 gives the same exposure, but you have to be more careful with focussing. 2 secs at f8 is also the same, but more likely to give camera shake. Take your pick. For slide film I still bracket +/- 1 stop in case I haven't set things up quite as before, but 90% of the time the middle exposure is best. Print film is much more forgiving, and needs no bracketing. Print processing, however, is not forgiving, as most labs use an averaged automatic exposure for printing, which gives exactly the same problem we were trying to avoid, and the prints come back with muddy grey backgrounds. Choose a lab that listens when you ask them to override the machine to give black backgrounds. Uppsala Foto Kompani (formerly Hasselblads) on Drottninggatan, for example.
Prints from slides are no problem, but very expensive.

And by the way, the command to display snapshot images on the sgi is :
% ipaste -n filename.rgb

We even have a program for making pretty labels for your slides. Not only do they look neater, but the printer can type a lot smaller than you can write, so you can fit more information on, and it does clever things like remembering constant information (like your name) and incrementing counters and dates. It's called the Craddoc Caption Writer ("CCW5" under "programs" on Jerry's Mac).

And remember that even if you plan to take photographs, you can grab and store images at your leisure, and then photograph them all together later.

Mark Harris Oct '98/May '99

This document is : http://xray.bmc.uu.se/markh/notes/image_proc.html