IMAGE_QUERY_FILE Function

Returns the image type in a specified image file.

Usage

Input Paramters

Keywords

Returned Value

Discussion


NOTE: For a list of supported image types, refer to the Discussion section of the IMAGE_READ function.

Example 1

status = IMAGE_QUERY_FILE('photo_pcx.sun', filetype)

PRINT, status, filetype

0, PCX

; The image file is a PCX file. The correct image type is obtained from ; the encoded ID number, which takes precedence over the specified ; filename extension.

status = IMAGE_QUERY_FILE('photo_pcx.sun', $ filetype, Default_Filetype = 'tif')

PRINT, status, filetype

0, PCX

; The image file is a PCX file. The correct image type is obtained from ; the encoded ID number, which takes precedence over both the filename ; suffix and the Default_Filetype keyword.

Example 2

status = IMAGE_QUERY_FILE('photo_tga.sun', $ filetype, Default_Filetype = 'tga')

PRINT, status, filetype

0, TGA

Example 3

status = IMAGE_QUERY_FILE('photo_tga.sun', $ filetype, Default_Filetype = 'tif')

PRINT, status, filetype

0, TIFF

; Note that the wrong image type, TIFF, was returned. Without an; encoded ID number in the graphics file, IMAGE_QUERY_FILE ; looks at the value of the Default_Filetype keyword, which in this ; case was incorrect.

status = IMAGE_QUERY_FILE('photo_tga.sun', filetype)

PRINT, status, filetype

0, SUN

; Here, once again the incorrect image type is returned for; a TGA file; since no encoded ID number was found, and ; no Default_Filetype keyword is specified, the function "guesses" ; the image type by looking at the filename suffix.

status = IMAGE_QUERY_FILE('photo_tga', filetype)

PRINT, status

-3

; This example code also returns an error status. The error results; because the function can't make a reasonable guess at the image type; without the following: an encoded ID number, the Default_Filetype ; keyword, and/or a filename suffix.

See Also





doc@boulder.vni.com
Copyright © 1999, Visual Numerics, Inc. All rights reserved.