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.
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):
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.
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.
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: