User's Guide

CONVERT

Import or export LAS image using ImageMagick "convert" utility.

Function:

CONVERT uses the ImageMagick "convert" utility to convert between LAS image format and the image formats supported by ImageMagick.

The images must have either one or three bands. The list of formats supported by ImageMagick can be displayed by entering the Unix command "man ImageMagick". See the User Notes for more information.

Parameters:

Subcommand -IN:
Convert from any of a large number of other image formats into LAS image format.

IN
Name of input non-LAS image. The format of the input image is specified by its file extension, such as ".gif" or ".tiff".

The full list of formats known to the ImageMagick "convert" utility can be displayed by typing "convert" (with no arguments) at the Unix prompt. However, not all of these formats can be successfully converted back to a flat binary array (".gray" or ".rgb") which LAS can interpret. For example, ".tiff" files having either one or three bands can be successfully converted, but only single-band ".gif" files. CONVERT-IN cannot process Postscript (".ps") files at all. A systematic investigation into which file types can be handled has not been attempted -- users should verify that the output is correct (e.g.,using XID) when trying to convert an unfamiliar file type.

OUT
Name of output LAS image.

NL
Number of lines in input image. If not known, the ImageMagick "display" module can be used to determine this: at the Unix prompt, type "display" followed by the input file name, then move the mouse into the display window, click the right mouse button to get a menu, and select "Miscellany" and "Image Info". Note that the "geometry:" line gives the image width (NS) before the height (NL).

NS
Number of pixels per line in input image. If not known, the ImageMagick "display" utility can be used to determine this: at the Unix prompt, type "display" followed by the input file name, then move the mouse into the display window, click the right mouse button to get a menu, and select "Miscellany" and "Image Info". Note that the "geometry:" line gives the the image width (NS) before the height (NL).

NBAND(1)
Number of bands in input image (must be 1 or 3).

ODTYPE("BYTE")
Data type for output LAS image.
Subcommand -OUT:
Convert from LAS image format to any of a large number of other formats.

IN
Name of LAS image to convert. The image specification may contain spatial and/or spectral windowing, and may specify a logical image comprised of two or three actual image files. However, the total number of input bands specified must be either 1 or 3.

OUT
Name of converted output image. The format of the output image is specified by its file extension, such as ".gif", ".tiff", or ".ps". The full list of possible output formats can be displayed by typing "convert" (with no arguments) at the Unix prompt.

Examples:

  1. LAS> convert-in in=streams.gif out=stream_map nl=500 ns=600 nband=3

    A color image in CompuServe graphics interchange format (GIF) with a width of 600 pixels and a height of 500 pixels is converted into LAS format.

  2. LAS> convert-out in="hourly_precip(101,251,600,800:6,12,18)" out=precip_fields.ps

    Three bands selected from an input image having a larger number of bands are converted to Postscript format.

Description/Algorithm:

For subcommand -IN, CONVERT checks that the number of input bands specified is either 1 or 3, and then uses the ImageMagick convert utility to change the input file to either a single-band 8-bit binary array or a three-band 8-bit per band red/green/blue band-sequential (BSQ) array, placing the result in a temporary file with file extension ".gray" or ".rgb", respectively. CONVERT then invokes the LAS TRANSLAS-IN program to convert the temporary file into LAS format.

For subcommand -OUT, CONVERT must first check that the number of bands specified for the input image is either 1 or 3 and determine the number of lines and samples to be output. This is done by using the LAS COPY command to copy the input to a temporary file, applying any spatial and/or spectral windows specified for argument IN; and then using the LAS GETIMGSZ command to obtain the number of bands, lines, and samples in the temporary file. CONVERT then renames the temporary ".img" file to either ".gray" (single band) or ".rgb" (three bands). The ImageMagick convert utility is then invoked to convert the temporary file to the desired output format.

When the conversion is complete, CONVERT deletes the temporary files.

Nonfatal Error Messages:

    None.

Fatal Error Messages:

  1. [convert-dtype] "Input image must have data type BYTE"

    The ImageMagick convert utility primarily supports image formats having not more than 8 bits per pixel. To use CONVERT-OUT for LAS images of other data types, the LAS MAP function should first be used to rescale the pixel values to fall within the range 0 to 255.

  2. [convert-bands] "Input must have either 1 or 3 bands"

    The ImageMagick convert utility primarily supports images having either one or three bands. CONVERT-IN cannot handle other types of input. For CONVERT-OUT, input LAS-format images with other numbers of bands can be handled, but only if the image specifier in argument IN explicitly defines a spectral window containing either 1 or 3 bands.

User Notes:

  1. The ImageMagick "convert" module must be available in one of the binary directories included in the user's PATH variable.

  2. The ImageMagick "display" utility can be used to determine the dimensions of an input image for CONVERT-IN. At the Unix prompt, type "display" followed by the input image file name, then move the mouse into the display window, click the right mouse button to get a menu, and select "Miscellany" and "Image Info". Note that the "geometry:" line gives the image width (NS) before the height (NL).

  3. The full list of formats known to the ImageMagick "convert" utility can be displayed by typing "man ImageMagick" at the Unix prompt. However, some of these formats cannot be successfully converted back to a flat binary array (".gray" or ".rgb") which CONVERT-IN can interpret correctly. CONVERT-IN and -OUT have been successfully tested using one- and three-band .gif, .jpeg, and .ps files.

  4. Although ImageMagick claims to support image depths of both 8 and 16 bits, the LAS CONVERT currently only supports 8-bit image depth.

  5. The ImageMagick "convert" utility does not appear to create 3-band .tiff files correctly.