Images and Color Graphics

Both image and color graphics can be handled in IM and VP, but the procedures for doing so vary depending on whether the image are gray-scale or color and depending on whether or not the images will be combined with graphics. Directions for handling the various cases are given below. In these directions, it is assumed that a recent version of profile.exg is used, in which the synonym "white" is defined as color value 0 and "black" is color value 7 (these synonyms are not commonly used in prior exg files, but in any case these definitions are the reverse of what occurred in earlier versions of profile.exg).

Gray-scale images

All images in IM consist of an array of 8-bit values. For gray-scale images, these are then displayed from IM using the DI command, which produces a img.PGM file that is then displayed using IrfanView. Labeling of that image within IM is accomplished with a LA command stream (those labels have gray value that is linearly interpolated around the edges of the labels, to eliminate sharp edges and corners). Output of such images to VP is accomplished with the OU/UIM command, which produces the img.uim file that is then input into VP with the include xxx image command. Subsequent drawing on that image within VP (in black and white) proceeds as usual. The characteristics of the display of the image in VP and the subsequent postscript file made with U-PS depend on the parameters used in both cases:

Color Line Drawings

For line drawings within VP, colors are used according to the default VP colors: 0: back (prints white), 1: blue, 2: green, 3: cyan, 4: red, 5: magenta, 6: yellow, 7: white (prints black), 8: brown, 9: dark blue, 10: dark green, 11: turquoise, 12: orange, 13: purple, 14: dark yellow, 15: gray. Subsequent conversion of such drawings into a postscript file is accomplished using the U-PS command, with the color option. Color labeling can also be accomplished within IM, using a LA/c command stream (the /c option turns off the interpolation of neighboring pixels, to avoid ill-defined results for neighboring pixels of various colors). Display of such color labels in IM is accomplished with the DC command, using option 4 for VP colors.

Color Images

For color images with IM, a color lookup table is associated with the image using the DC command which associates a lookup table with the image (presently available lookup tables are 1=gray-scale, 2=black-body, 3=rainbow, 4=VP). A file img.PPM is subsequently output, and displayed with IrfanView. To display images with the same color scales in VP, it is necessary to define a new .ugh file for the look-up table, and to print such VP displays in the same color scheme it is necessary to redefine the "color" look-up table in the U-PS.PRO file.

Mixing Gray-scale Images and Color Line Drawings

Careful reading of the above descriptions will reveal that there are various discrepencies between the procedures for gray-scale images and color line drawings, both within IM and VP: the U-PS command of VP is used without the color option for gray-scale images but with that option for color drawings, any labeling within IM must use the /c option for color, and the lookup tables within IM (incorporated as part of the DI or DC commands) are different for gray-scale and color renderings. To permit combination of gray-scale images and color labeling (either within IM or VP), a special type of lookup table is employed that uses data values 0-15 for the default VP colors and values 16-255 values for gray shades. To enable use to this "mixed" scheme within IM, the construction of images (with the GRAY command) should use the /m option, i.e. GRAY/m, in which case the gray scale shades are all put into the 16-255 data values (with nothing in the 0-15 values, until further labeling of the image is done either using LAbeling command within IM or using VP commands). Other operations on the image such as reversing the grey-scale range (with RV command) also must employ the /m option. Subsequent input of the image into VP is accomplished in the usual way with OU/UIM in IM and include xxx image in VP. Display of the image in VP should be done using the view mixedb.ugh or view mixedw.ugh commands prior to the actual view erase fill command. These commands input the appropriate lookup tables: for mixedb.ugh (black background) colors are 0=black, 1=blue, 2=green, ..., 7=white, etc. and for mixedw.ugh (white background) colors are 0=white, 1=blue, 2=green,..., 7=black, etc. Conversion of the UGH file to postscript then must use the color option of the U-PS command (the appropriate lookup table values are incorporated in the U-PS.PRO file, and some additional definitions in profile.exg), in which case 0=white and 7=black. Thus, use mixedw.ugh to produce a view in VP that is identical to what is obtained from UGH with the color option. This method is the "new" method for handling images within VP, used for some or all files after Oct/11.