The C++ Template Image Processing Library.    

[Introduction]- [News]- [Download]- [Screenshots]- [Tutorial]- [Forums]- [Reference]- [SourceForge Repository ]

Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

Introduction to the CImg Library

The CImg Library consists in a single header file CImg.h providing a set of C++ classes that can be used in your own sources, to load/save, process and display images. Very portable (Unix/X11,Windows, MacOS X, FreeBSD,..), efficient, simple to use, it's a pleasant toolkit for coding image processing stuffs in C++.

Library structure

The file CImg.h contains all the classes and functions that compose the library itself. It is organized as follows :

Knowing these five classes is enough to get benefit of most of the CImg Library functionalities.

As you can see, all the library functions and classes are defined in a single header file CImg.h. This may sound strange, but it is actually one major advantage of the CImg library :

CImg version of "Hello world".

Below is a very simple code that creates a "Hello World" image. This shows you basically how a CImg program looks like.

  #include "CImg.h"
  using namespace cimg_library;

  int main() {
    CImg<unsigned char> img(640,400,1,3);        // Define a 640x400 color image
    img.fill(0);                                 // Set pixel values to 0 (color : black)
    unsigned char purple[3]={255,0,255};         // Define a purple color
    img.draw_text("Hello World",100,100,purple); // Draw a purple "Hello world" at coordinates (100,100).
    img.display("Hello World");                  // Display the image
    return 0;
  }

Which can be also written in a more compact way as :

  #include "CImg.h"
  using namespace cimg_library;

  int main() {
    const unsigned char purple[3]={255,0,255};
    CImg<unsigned char>(640,400,1,3,0).draw_text("Hello World",100,100,purple).display("Hello World");
    return 0;
  }

Generally, you can write very small code that performs complex image tasks. The CImg Library is very simple to use but provide a lot of interesting algorithms for image manipulation.

How to compile ?

The CImg library is a very light and user-friendly library : only standart system libraries are used. this avoid to handle complex dependancies and problems with library compatibility. The only thing you need is a (quite modern) C++ compiler. Before each release, the CImg library is successfully compiled with the following compilers :

If you are using another compilers and encounter problems, please write me since maintaining compatibility is one of my priority.

What's next ?

If you are ready to get more, and to start writing more serious programs with CImg, you are invited to go to the Tutorial : Getting Started. section.
Generated on Thu Dec 2 11:26:17 2004 for The CImg Library by  doxygen 1.3.9.1