QUERY_PNG is a method of obtaining information about a PNG image file without having to read the file. See QUERY_* Routines for more information.
Result = QUERY_PNG ( Filename [, Info] )
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.
A scalar string containing the pathname of the PNG file to query.
Returns an anonymous structure containing information about the image in the file. The Info.TYPE field will return the value `PNG'.
| Note |
None
Query included in creating RGBA (16-bit/channel) and Color Indexed
(8-bits/channel) image.
rgbdata = UINDGEN(4,320,240) cidata = BYTSCL(DIST(256)) red = indgen(256) green = indgen(256) blue = indgen(256) WRITE_PNG,'rgb_image.png',rgbdata WRITE_PNG,'ci_image.png',cidata,red,green,blue ; Query and Read the data: names = ['rgb_image.png','ci_image.png','unknown.png'] FOR i=0,N_ELEMENTS(names)-1 DO BEGIN ok = QUERY_PNG(names[i],s) IF (ok) THEN BEGIN HELP,s,/STRUCTURE IF (s.HAS_PALETTE) THEN BEGIN img = READ_PNG(names[i],rpal,gpal,bpal) HELP,img,rpal,gpal,bpal ENDIF ELSE BEGIN img = READ_PNG(names[i]) HELP,img ENDELSE ENDIF ELSE BEGIN PRINT,names[i],' is not a PNG file' ENDELSE ENDFOR END
Introduced: 5.2
QUERY_* Routines, READ_PNG, WRITE_PNG