Routines (alphabetical) > Routines: H > HDF Routines > HDF_DFR8_ADDIMAGE

# HDF_DFR8_ADDIMAGE

The HDF_DFR8_ADDIMAGE procedure appends an 8-bit raster image to the specified HDF 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.

## Examples

Assuming that we start with a file, `new.hdf`, with no 8-bit raster images, images could be appended and overwritten, with the following commands:

; Write the first image to the file:

HDF_DFR8_ADDIMAGE, 'new.hdf', Image1

; Append 2nd image:

HDF_DFR8_ADDIMAGE, 'new.hdf', Image2

; Append 3rd image:

HDF_DFR8_ADDIMAGE, 'new.hdf', Image3

; Use HDF_DFR8_PUTIMAGE to erase all previous images and

; write a new image at the first position in the file:

HDF_DFR8_PUTIMAGE, 'new.hdf', Image4

; Append 2nd image:

HDF_DFR8_ADDIMAGE, 'new.hdf', Image5

## Syntax

HDF_DFR8_ADDIMAGE, Filename, Image [, /FORCE_BASELINE{useful only if QUALITY<25}] [, /JPEG | , /RLE] [[, /IMCOMP] , PALETTE=vector or array] [, 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 in the IDL Reference Guide 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

4.0 | Introduced

## See Also

HDF_DFR8_GETIMAGE, HDF_DFR8_PUTIMAGE, WRITE_JPEG