Appendix 2: Porting images to and from IPW

Common Image formats

xv reads and writes several common image formats. (GIF, TIFF, PBM, X11 Bitmap, Sun Raster, Postscript, JPEG). For a small number of images in one of these formats, xv is suitable.

The IPW programs pbm2ipw and ipw2pbm convert IPW images to the Portable BitMap format. Use the public domain program imconv or the Pbmplus package to convert PBM images to and from other formats.

GRASS

User contributed IPW programs from the EPA convert IPW images to and from GRASS. Refer to the EPA document "Supplement to the Image Processing Workbench" (Longley and Marks, 1991) for more information on these commands.

`Raw' Files

If your image is available as a binary data file containing an array of pixels, you simply need to add the IPW header.

% mkbih -l #lines -s #samps -i #bits < image > image.ipw

where #lines, #samps, #bits are the number of lines (rows), samples (columns), and bits per pixel respectively.

If the data consists of integers in an ASCII text file, convert it to binary and add the IPW header.

% atob -#bytes < image | mkbih -l #lines -s #samps -i #bits > image.ipw

where #bytes is the number of bytes per pixel in the output image.

If the data consists of floating point values in an ASCII text file or binary file, the program import will convert it to `linear quantizations', the IPW representation of floating point values. (see Frew 1990 pp. 12-13 for more information on linear quantizations)

To output a raw binary data file from IPW for processing by another system, remove the IPW header.

% rmhdr image.ipw > image.raw

To print an image as ASCII values (either integer or floating point), use the command primg.

% primg -a < image.ipw > image.ascii

This will print floating point values if the image was stored in a linear quantization format. If the image is in this format and you wish to print it the integer representation, use the -r option in primg.

% primg -a -r < image.ipw > image.ascii

Band-Interleaved by Line

Binary, band-interleaved by line images, such as ERDAS can be converted to band-interleaved by pixel using the program bil2bip, and piped to mkbih to produce an IPW image.

% bil2bip nlines nsamps nbands < image |

Landsat Thematic Mapper Imagery

tmpt can be used to create an IPW image from a Landsat Thematic Mapper Image tape.

Digital Elevation Models

dempt converts a USGS Digital Elevation Model (DEM) to an IPW image.

Other Formats

The EPA Supplement to the IPW manual (Longley, Marks 1991) contains sections on Importing Data to IPW, and Exporting Data from IPW, with detailed examples.