The HDF_DFR8_PUTIMAGE procedure writes an 8-bit raster image as the first image in an HDF file. If there are images in the file, this procedure erases all other 8-bit and 24-bit images and writes Image as the first image in the file.
Note: Input data is converted to bytes before being written to the file, as images in the DFR8 HDF model are necessarily byte images.
Syntax
HDF_DFR8_PUTIMAGE, Filename, Image [, /FORCE_BASELINE{useful only if QUALITY<25}] [[, /IMCOMP] , PALETTE=vector or array] [, /JPEG | , /RLE] [, QUALITY=value]
Arguments
Filename
A scalar string containing the name of the file to be written.
Image
A two-dimensional array containing the image data. If this array is not byte-type data, it is converted to bytes before writing.
Keywords
FORCE_BASELINE
Set this keyword to force the JPEG quantization tables to be constrained to the range 1...255. This provides full baseline compatibility with external JPEG applications, but only makes a difference if the QUALITY keyword is set to a value less than 25. The default is TRUE.
JPEG
Set this keyword to compress the image being added using the JPEG (Joint Photographic Expert Group) method. Note that JPEG compression is lossy; see WRITE_JPEG for more information about when this method is appropriate. (In other words, using JPEG compression to reduce the size of an images changes the values of the pixels and hence may alter the meaning of the corresponding data.) Setting either the QUALITY or the FORCE_BASELINE keywords implies this method.
IMCOMP
Set this keyword to store the image using imcomp data compression. Note that you must specify a palette. Note also that the JPEG and RLE compression methods are far superior; imcomp data compression should only be used if the images will be viewed on monitors with a very small number of colors (monochrome or 16-color).
PALETTE
Set this keyword to a vector or array containing valid palette data. Palettes must be either [3, 256] arrays or 786-element vectors. Set PALETTE equal to zero to specify that no palette be used. If the PALETTE keyword is not specified, the current palette (which may be no palette, if a palette has not been specified elsewhere or if the null palette has been explicitly specified with HDF_DFR8_SETPALETTE) will be used.
Note that if a palette is specified, it becomes the current palette, even if a default palette has been specified with HDF_DFR8_SETPALETTE.
Note also that if IMCOMP data reduction is used, you must specify a valid palette with the PALETTE keyword. It is not sufficient to set the current palette via other means.
QUALITY
Set this keyword equal to the JPEG “quality” desired. This value should be in range 0 (terrible image quality but excellent compression) to 100 (excellent image quality but minimum compression). The default is 75. Setting this keyword implies that the JPEG keyword is set. Lower values of QUALITY produce higher compression ratios and smaller files.
RLE
Set this keyword to store the image using run length compression. RLE compression is lossless, and is recommended for images where data retention is critical.
Version History
See Also
HDF_DFR8_ADDIMAGE, HDF_DFR8_GETIMAGE, WRITE_JPEG