Automatic Color Enhancement
Automatic Color Enhancement Documentation
Automatic Color Enhancement (ACE) and its Fast Implementation
Pascal Getreuer,, CMLA, ENS Cachan
Version 20130706 (July 6, 2013)

  *** Please cite IPOL article "Automatic Color Enhancement (ACE) and ***
  *** its Fast Implementation" if you publish results obtained with   ***
  *** this software.                                                  ***

== Overview ==

This C source code is a revision of the code accompanying Image Processing On
Line (IPOL) article "Automatic Color Enhancement (ACE) and its Fast 
Implementation" at

The original peer-reviewed IPOL version of the code is available from the
article page.

Future software releases and updates will be posted at

Compared to the IPOL version, this revision differs in the following ways:

    * Included zlib.h in imageio.c for compatibility with libpng 1.5 and later
    * Removed arbitrary limit on alpha in acecli.c

== License (BSD) ==

File avs.jpg was created by NASA (

All other files are distributed according to the simplified BSD license.  You
should have received a copy of this license along this program.  If not, see

== Program Usage ==

This source code includes two command line programs: ace and histeq

    * ace: runs ACE color enhancement

    * histeq: performs uniform histogram equalization

--- ace ---

Usage: ace [options] input output

where "input" and "output" are BMP files (JPEG, PNG, or TIFF files can also
be used if the program is compiled with libjpeg, libpng, and/or libtiff).

  -a <number>  alpha, stronger implies stronger enhancement
  -w <omega>   omega, spatial weighting function, choices are
               1/r      default ACE, omega(x,y) = 1/sqrt(x^2+y^2)
               1        constant, omega(x,y) = 1
               G:#      Gaussian, where # specifies sigma,
                        omega(x,y) = exp(-(x^2+y^2)/(2 sigma^2))
  -m <method>  method to use for fast computation, choices are
               interp:# interpolate s_a(L - I(x)) with # levels
               poly:#   polynomial s_a with degree #

  -q <number>  quality for saving JPEG images (0 to 100)

--- histeq ---

Usage: histeq [options] input output

   -b <number>     number of histogram bins (default 256)
   -q <number>     quality for saving JPEG images (0 to 100)


    # Perform ACE automatic color enhancement on avs.jpg with alpha = 8
    ./ace -a 8 -m interp:12 avs.jpg ace.bmp

    # Perform uniform histogram equalization
    ./histeq avs.jpg equalized.bmp

Note: If the programs are compiled without libjpeg support, please convert
avs.jpg to avs.bmp in Windows Bitmap BMP format and use this as the input.

Each of these programs prints detailed usage information when executed
without arguments or "--help".

== Compiling ==

Instructions are included below for compiling on Linux sytems with GCC, on
Windows with MinGW+MSYS, and on Windows with MSVC.

Compiling requires the FFTW3 Fourier transform library (
For supporting additional image formats, the programs can optionally be
compiled with libjpeg, libpng, and/or libtiff.  Windows BMP images are always

== Compiling (Linux) ==

To compile this software under Linux, first install the development files for
libfftw, libjpeg, libpng, and libtiff.  On Ubuntu and other Debian-based
systems, enter the following into a terminal:
    sudo apt-get install build-essential libfftw3-dev libjpeg8-dev libpng-dev libtiff-dev
On Redhat, Fedora, and CentOS, use
    sudo yum install make gcc libfftw-devel libjpeg-turbo-devel libpng-devel libtiff-devel

Then to compile the software, use make with makefile.gcc:

    tar -xf ace_20130706.tar.gz
    cd ace_20130706
    make -f makefile.gcc

This should produce two executables, ace and histeq.

Source documentation can be generated with Doxygen (

    make -f makefile.gcc srcdoc

== Compiling (Windows) ==

The MinGW+MSYS is a convenient toolchain for Linux-like development under
Windows.  MinGW and MSYS can be obtained from

The FFTW3 library is needed to compile the programs.  FFTW3 can be
obtained from

Instructions for building FFTW3 with MinGW+MSYS can be found at

--- Building with BMP only ---

The simplest way to build the tvdeconv programs is with support for only BMP
images.  In this case, only the FFTW3 library is required.  Edit makefile.gcc
and comment the LDLIB lines to disable use of libjpeg, libpng, and libtiff:

    #LDLIBPNG=-lpng -lz

Then open an MSYS terminal and compile the program with

    make CC=gcc -f makefile.gcc

This should produce the executables ace and histeq.

--- Building with PNG, JPEG, and/or TIFF support ---

To use the tvdeconv program with PNG, JPEG, and/or TIFF images, the
following libraries are needed.

    For PNG:    libpng and zlib
    For JPEG:   libjpeg
    For TIFF:   libtiff

These libraries can be obtained at

It is not necessary to include support for all of these libraries, for
example, you may choose to support only PNG by building zlib and libpng
and commenting the LDLIBJPEG and LDLIBTIF lines in makefile.gcc.

Instructions for how to build the libraries with MinGW+MSYS are provided at

Once the libraries are installed, build the tvdeconv programs with the
makefile.gcc included in this archive.

    make CC=gcc -f makefile.gcc

This should produce two executables, ace and histeq.

== Compiling (Mac OSX) ==

The following instructions are untested and may require adaptation, but
hopefully they provide something in the right direction.

First, install the XCode developer tools.  One way to do this is from
the OSX install disc, in which there is a folder of optional installs
including a package for XCode.

The program requires the free FFTW library to build.  Optionally, it can
also use the libpng, libjpeg, and libtiff libraries to support more image
formats.  These libraries can be obtained on Mac OSX from the Fink project

Go to the Download -> Quick Start page for instructions on how to get
started with Fink.  The Fink Commander program may then be used to download
and install the packages fftw, libpng, libjpeg, and libtiff.  It may be
necessary to install fftw-dev, libpng-dev, libjpeg-dev, and libtiff-dev as

Once the libraries are installed, compile the program using the included
makefile "makefile.gcc":

    make -f makefile.gcc

This should produce the executables ace and histeq.

== Acknowledgements ==

This material is based upon work supported by the National Science
Foundation under Award No. DMS-1004694.  Any opinions, findings, and
conclusions or recommendations expressed in this material are those of
the author(s) and do not necessarily reflect the views of the National
Science Foundation.