QUERY_TIFF is a method of obtaining information about a TIFF image file without having to read the file. See QUERY_* Routines for more information.

Examples


This is an example of using QUERY_TIFF to write and read a multi-image TIFF file. The first image is a 16-bit, single channel image stored using compression. The second image is an RGB image stored using 32-bits/channel uncompressed.

PRO ex_query_tiff
 
; Write the image data:
data = FIX(DIST(256))
rgbdata = LONARR(3,320,240)
tif_file = FILEPATH('multi.tif', /TMP)
WRITE_TIFF,tif_file,data,COMPRESSION=1,/SHORT
WRITE_TIFF,tif_file,rgbdata,/LONG,/APPEND
 
; Read the image data back:
ok = QUERY_TIFF(tif_file,s)
IF (ok) THEN BEGIN
   FOR i=0,s.NUM_IMAGES-1 DO BEGIN
      imp = QUERY_TIFF(tif_file,t,IMAGE_INDEX=i)
      img = READ_TIFF(tif_file,IMAGE_INDEX=i)
      HELP,t,/STRUCTURE
      HELP,img
   ENDFOR
ENDIF
END

Syntax


Result = QUERY_TIFF ( Filename [, Info] [, GEOTIFF=variable] [, IMAGE_INDEX=index] )

Return Value


This routine returns a long with the value of 1 (one) if the query was successful (and the file type was correct) or 0 (zero) on failure.

Arguments


Filename

A scalar string containing the pathname of the TIFF file to query.

Info

Returns an anonymous structure containing information about the image in the file. The Info.TYPE field will return the value ‘TIFF’.

Note: See General Query * Routine Info Structures for detailed structure information.

Note: In addition to the fields returned in the Info structure for all image types, there are a number of extra fields in the Info structure for TIFF images. See QUERY_TIFF-Specific Routine Info Structures for detailed structure info.

Keywords


GEOTIFF

Set this keyword to a named variable in which to return an anonymous structure containing the GeoTIFF tags and keys found in the file. If no GeoTIFF information is present in the file, the returned variable is set to a scalar zero. For a description of the possible GeoTIFF tags see the GEOTIFF keyword in READ_TIFF.

Tip: This keyword returns the same information as the GEOTIFF keyword to READ_TIFF, but avoids the overhead of reading in the entire image.

IMAGE_INDEX

Image number index. If this value is larger than the number of images in the file, the function returns 0 (failure).

Version History


5.2

Introduced

6.1

Added DESCRIPTION, DOCUMENT_NAME, DATE_TIME, and POSITION Info structures

Added GEOTIFF keyword

8.2 Added support for BigTIFF files.

See Also


QUERY_* Routines, READ_TIFF, WRITE_TIFF