Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

QUERY_IMAGE


Syntax | Return Value | Arguments | Keywords | Version History

The QUERY_IMAGE function determines whether a file is recognized as a supported image file. QUERY_IMAGE first checks the filename suffix, and if found, calls the corresponding QUERY_ routine. For example, if the specified file is image.bmp, QUERY_BMP is called to determine if the file is a valid .bmp file. If the file does not contain a filename suffix, or if the query fails on the specified filename suffix, QUERY_IMAGE checks against all supported file types.

Syntax

Result = QUERY_IMAGE ( Filename[, Info] [, CHANNELS=variable] [, DIMENSIONS=variable] [, HAS_PALETTE=variable] [, IMAGE_INDEX=index] [, NUM_IMAGES=variable] [, PIXEL_TYPE=variable] [, SUPPORTED_READ=variable] [, SUPPORTED_WRITE=variable] [, TYPE=variable] )

Return Value

Result is a long with the value of 1 if the query was successful (the file was recognized as an image file) or 0 on failure. The return status will indicate failure for files that contain formats that are not supported by the corresponding READ_* routine, even though the file may be valid outside the IDL environment.

If the file is a supported image file, an optional structure containing information about the image is returned. If the file is not a supported image file, QUERY_IMAGE returns 0.

Arguments

Filename

A scalar string containing the name of the file to query.

Info

An optional anonymous structure containing information about the image. This structure is valid only when the return value of the function is 1. The Info structure for all image types has the following fields:

Tag
Type

CHANNELS

Long

DIMENSIONS

Two-dimensional long array

FILENAME

Scalar string

HAS_PALETTE

Integer

IMAGE_INDEX

Long

NUM_IMAGES

Long

PIXEL_TYPE

Integer

TYPE

Scalar string

Keywords

CHANNELS

Set this keyword to a named variable to retrieve the number of channels in the image.

DIMENSIONS

Set this keyword to a named variable to retrieve the image dimensions as a two-dimensional array.

HAS_PALETTE

Set this keyword to a named variable to equal to 1 if a palette is present, else 0.

IMAGE_INDEX

Set this keyword to the index of the image to query from the file. The default is 0, the first image.

NUM_IMAGES

Set this keyword to a named variable to retrieve the number of images in the file.

PIXEL_TYPE

Set this keyword to a named variable to retrieve the IDL Type Code of the image pixel format. See the documentation for the SIZE routine for a complete list of IDL Type Codes.

The valid types for PIXEL_TYPE are:

SUPPORTED_READ

Set this keyword to a named variable to retrieve a string array of image types recognized by READ_IMAGE. If the SUPPORTED_READ keyword is used the filename and info arguments are optional.

SUPPORTED_WRITE

Set this keyword to a named variable to retrieve a string array of image types recognized by WRITE_IMAGE. If the SUPPORTED_WRITE keyword is used the filename and info arguments are optional.

TYPE

Set this keyword to a named variable to retrieve the image type as a scalar string. Possible return values are BMP, JPEG, PNG, PPM, SRF, TIFF, or DICOM.

Version History

Introduced: 5.3


Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]