IRAF Newsletter -- Number 14 -- April 1998

[ Previous ] [ Next ] [ Table of Contents ] [ Search this issue ]

Converting IRAF images with IMPORT/EXPORT

Two new tasks have been added to the dataio package for converting images to and from the internal IRAF formats:


Convert IRAF images to some other format


Convert some other format to an IRAF image

The import task has a user-extensible database of image formats it uses to automatically recognize and read image formats including GIF, Sun rasterfile, PGM and PPM, X11, etc. Task parameters allow for the reading of arbitrary binary files, support all datatypes and permit padding and interleaving of data. An "outbands" parameter is a list of expressions which are evaluated to compute the pixels in each band of the output image. Operands in these expressions consist of numeric constants and the pixel "tags". General arithmetic expressions are supported which can include any of the builtin functions used to change the image orientation and separate or combine input color components.

The export task can take one or more input IRAF images and convert them to various output formats or a raw binary raster. One of the more useful output formats supported is Encapsulated PostScript (color EPS is also supported). This task has an "outbands" expression parameter that lets you manipulate the input images, but the list of builtin functions is more extensive than with the import task. For output formats which allow color, input images may be written as individual RGB components in 24-bit formats or combined to compute an 8-bit pseudocolor colormap. Other colormaps may also be applied. Multiple input images may be combined spatially to form a mosaic of images in the output format. Images can be scaled to 8-bits using the same z-scale algorithm as in the display task; a brightness/contrast value may also be applied to final output image. As an example, to write four images to a grayscale EPS file, scaling each one individually such that they are tiled in a 2x2 grid:

It is possible to pad the images with blank space so they are separated with a more complex expression.

With the exception of GIF, only pixel raster formats are currently supported by either task. There is great interest in formats like TIFF and JPEG; however, these cannot be fully supported without implementing all aspects of the format (all possible tags, compression, etc.). We may add support for these formats in the future. For now it is best to use one of the supported formats as an intermediate and use host tools to convert to the final format.

Mike Fitzpatrick

[ Previous ] [Next ] [ Table of Contents ] [ Search this issue ]

IRAF Group, National Optical Astronomy Observatories, P.O. Box 26732, Tucson, AZ 85726, Phone: (520) 318-8160, FAX: (520) 318-8360, Email

Posted: 07May1998