Go up one levelGo to Previous Go to Next

Image Compression

There are many situations in which you need to compress or decompress images. For example, to save space in an archive, or to save network transfer time. The Compress class provides methods to compress and decompress images using one of the following compression types:

Keyword

Description

UNIX_COMPRESS

UNIX style compress, as with the UNIX compress(1) command

H_COMPRESS

H-compress (lossy compression, reduces the amount of data)

ULDA_COMPRESS

ULDA compressed FITS file

GZIP_COMPRESS

Compress using the GNU gzip command.

The following example compresses and then decompresses the file "test.fits" using the H-compress compression type:

 
if (c.compress("test.fits", "test.hfits", Compress::H_COMPRESS) != 0) 
		return ERROR;

if (c.decompress("test.hfits", "test.fits", Compress::H_COMPRESS) != 0)
		return ERROR

See the man page Compress(3) for more details.


Go up one levelGo to Previous Go to Next

Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory