READ_TIFF

The READ_TIFF function reads 8-bit, 16-bit, or 24-bit images in TIFF format files (classes G, P, and R) and returns the image and color table vectors in the form of IDL variables. READ_TIFF returns an 8, 16, or 32-bit array containing the image data. Only one image per file is read. READ_TIFF returns a byte array containing the image data. The dimensions of the result are the same as defined in the TIFF file ( Columns, Rows ).

For TIFF images that are RGB interleaved by pixel, the output dimensions are ( 3, Columns, Rows ).

For TIFF images that are RGB interleaved by image, READ_TIFF returns the integer value zero, sets the variable defined by the PLANARCONFIG keyword to 2, and returns three separate images in the variables defined by the R, G, and B arguments.

This routine is written in the IDL language. Its source code can be found in the file read_tiff.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = READ_TIFF ( Filename[, R, G, B] )

Arguments

Filename

A scalar string specifying the full pathname of the TIFF file to read.

R, G, B

Named variables that will contain the Red, Green, and Blue color vectors of the color table from the file.

Keywords

ORDER

Set this keyword to a named variable that will contain the order value from the TIFF file. This value is returned as 0 for images written bottom to top, and 1 for images written top to bottom. If an order value does not appear in the TIFF file, an order of 1 is returned.

The ORDER keyword can return any of the following additional values (depending on the source of the TIFF file):

  • Values for the ORDER keyword

Rows

Columns

1

top to bottom, left to right

2

top to bottom, right to left

3

bottom to top, right to left

4

bottom to top, left to right

5

top to bottom, left to right

6

top to bottom, right to left

7

 bottom to top, right to left

8

bottom to top, left to right

Reference: Aldus TIFF 6.0 spec (TIFF version 42).

PLANARCONFIG

Set this keyword to a named variable that will contain the interleave parameter for the TIFF file. This parameter is returned as 1 for TIFF files that are GrayScale, Palette, or RGB color interleaved by pixel. This parameter is returned as 2 for RGB color TIFF files interleaved by image.

UNSIGNED

Set this keyword to return TIFF files containing unsigned 16-bit integers as signed 32-bit longword arrays. If not set, return a signed 16-bit integer for these files. In this case, data values between 32768 and 65535 are returned as negative values between -32768 and -1. This keyword has no effect if the input file does not contain 16-bit integers.

Example

Read the file my.tif in the current directory into the variable image , and save the color tables in the variables, R , G , and B by entering:

image = READ_TIFF('my.tif', R, G, B)

To view the image, load the new color table and display the image by entering:

TVLCT, R, G, B

TV, image

See Also

WRITE_TIFF