Chapters: 1: Introduction 2: Simple example 3: Invocation 4: Finer Control 5: X-Y Plots 6: Contour Plots 7: Image Plots 8: Examples 9: Gri Commands 10: Programming 11: Environment 12: Emacs Mode 13: History 14: Installation 15: Gri Bugs 16: Test Suite 17: Gri in Press 18: Acknowledgments 19: License Indices: Concepts Commands Variables |
7: Image PlotsGri can read in images stored in various formats. It can also create image data internally, by converting gridded data, which is quite handy in some contouring applications.Note: if your diagram is to be reproduced by a journal, it is unlikely that the reproduction will be able to distinguish between any two graylevels which differ by less than 0.2. Also, graylevels less than 0.2 may appear as pure black, while those of 0.8 or more may appear as pure white. These guidelines are as specified by American Geophysical Union (publishers of J. Geophysical Res.), as of 1998.
7.1: Reading and Creating Image DataGri can do black and white image plots, such as satellite images. There are several ways to create image data in Gri
Once the image is created, its grayscale/colorscale may be manipulated
with the commands `
It is important to understand the structure of image data. Gri works
only with 8-bit image data. This means that a given pixel of the image
may have only one of 256 possible values. The example below uses a
satellite image of surface temperature. The suppliers of the data
dictate that pixel value 0 corresponds to a temperature of 5C, and a
pixel value of 255 corresponds to 30.5C, so the resolution is 0.1C per
pixel value. This resolution will be apparent if the output of the
example below is previewed on a grayscale/color monitor --- notice the
quantization in the palette. This resolution issue is not very
important with satellite images, since you have to use what you are
given by the suppliers of the data. However, the issue is very important
when you are converting grid data to images. When Gri converts grid
data to image data, it neccessarily discards information, because the
grid data have resolution to about 6 digits, whereas the image data have
only 8-bit (2-3 digit) resolution. The ` 7.2: About The PostScript OutputProgrammers Note: Gri inserts some special comments in the PostScript file, to help programmers extract the image data; to extract the information, you'll have to understand how PostScript handles images. Gri inserts a single comment line before a line ending in the token `im ':
The first four numbers are the (x,y) locations of the lower-left and
upper-right corners of the image, in units of points on the page (72
points = 1 inch). The fifth and sixth numbers are the width of the
image and the height of the image. The keyword `
7.3: Example (Satellite image)Here's an example that will plot different types of images, depending on your answers to `query ' questions. The file called
`\filename' is the data file, in binary format with one byte
(`unsigned char ' in C) for each pixel, stored with the northwest
pixel first, and the pixel to the east of that next. The file called
`\mask ' is in the same format, and the numbers are 0 if the point
is over the sea and 1 if over land. The mask file is used in computing
the histograms, which is done if `\histo ' is 1.
The file in this example covers 128 * 128 pixels over the Gulf of
Maine. The numbers in `
which explains the following lines in the command file:
Depending on `
|