Skip to main content

Hcompress Image Compression Software

Hcompress is the image compression package written by Richard L. White for use at the Space Telescope Science Institute. Hcompress was used to compress the STScI Digitized Sky Survey and has also been used to compress the preview images in the Hubble Data Archive. Briefly, the method used is:

  • a wavelet transform called the H-transform (a Haar transform generalized to two dimensions), followed by
  • quantization that discards noise in the image while retaining the signal on all scales, followed by
  • quadtree coding of the quantized coefficients.

The technique gives very good compression for astronomical images and is fast, requiring about 1 second for compression or decompression of a 512x512 image on a Sun SPARCstation 2. (Yes, this software was written a long time ago.) The calculations are carried out using integer arithmetic and are entirely reversible. Consequently, the program can be used for either lossy or lossless compression, with no special approach needed for the lossless case (e.g. there is no need for a file of residuals.) Documentation on the use of the programs and on the compression method is included in the doc subdirectory.

These programs can compress 2-byte integer images in a small variety of input formats (including FITS format, the most widely used format for astronomical images.) The resulting compressed image file is machine-independent and may be transferred between computers with binary FTP. The source code is reasonably machine-independent, although it has not been tested on a wide range of machines. Installation instructions for Unix machines are given in the README file and below.
 

Software Version

This is version 1.2 of the program, released 2018 February 7. This is the first version that uses the Gnu configure build system. Functionally the software is almost identical to the previous (1994!) release, but one bug that affected the decompression of images with pixel values near the bounds of the 16-bit integer range (-32768 or 32767) has been fixed. Note that the compressed images are not affected by this bug, so data compressed with the preceding version has no problems.

Other changes of note: The software has been recoded to ANSI C standards and the interfaces have been changed to make it easily embedded in other applications (in which case the compressed data are written and read from an in-memory buffer rather than a file).
 

Installation Instructions

The README file in the package describes the installation instructions. For a standard build do this:

  • Download the compressed tar file with the source code:
    hcomp-1.2.tar.gz
  • Run these commands to build and install the software:
    tar xzf hcomp-1.2.tar.gz
    cd hcomp-1.2
    ./configure
    make
    make install
    
    That will compile hcomp and install it in the standard locations. If you stop after make, the executables are in the src directory.
     
  • The configure script has the usual options. E.g., to change the installation location:
    ./configure --prefix=/home/rlw
    
    The INSTALL file describes additional options for the installation.
     
  • The installed scripts (with the default prefix) are:

    Binary executables:
    /usr/local/bin/hcomp
    /usr/local/bin/hdecomp
    
    csh wrapper scripts:
    /usr/local/bin/hcompress
    /usr/local/bin/hdecompress
    /usr/local/bin/fcompress
    /usr/local/bin/fdecompress
    
    Man page:
    /usr/local/man/man1/hcompress.1
    

Known Bugs

There are no known bugs in this version. Bugs can be reported through

 

Copyright (c) 1994 Association of Universities for Research in Astronomy. All rights reserved. Produced under National Aeronautics and Space Administration Contract No. NAS5-26555.