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

# Setting Environment Variables

The CImg library is a multiplatform library, working on a wide variety of systems. This implies the existence of some environment variables that must be correctly defined depending on your current system. Most of the time, the CImg Library defines these variables automatically (for popular systems). Anyway, if your system is not recognized, you will have to set the environment variables by hand. Here is a quick explanations of environment variables.

Setting the environment variables is done with the `#define` keyword. This setting must be done before including the file CImg.h in your source code. For instance, defining the environment variable `cimg_display_type` would be done like this :

      #define cimg_display_type 0
      #include "CImg.h"
      ...

Here are the different environment variables used by the CImg Library :

- `cimg_OS` : This variable defines the type of your Operating System. It can be set to 0 (Solaris), 1 (Linux), 2 (Windows), 3 (Mac \ OS X), 4 (FreeBSD) or -1 (Other configuration). It should be actually auto-detected by the CImg library. If this is not the case (`cimg_OS=-1`), you will probably have to tune the environment variables described below.

- `cimg_display_type` : This variable defines the type of graphical library used to display images in windows. It can be set to 0 (no display library available), 1 (X11-based display) or 2 (Windows-GDI display). If you are running on a system without X11 or Windows-GDI ability, please set this variable to `0`. This will disable the display support, since the CImg Library doesn't contain the necessary code to display images on systems other than X11 or Windows GDI.

- `cimg_color_terminal` : This variable tells the library if the system terminal has VT100 color capabilities. It can be defined or not defined. Define this variable to get colored output on your terminal, when using the CImg Library.

- `cimg_debug` : This variable defines the level of run-time debug messages that will be displayed by the CImg Library. It can be set to 0 (no debug messages), 1 (normal debug messages, which is the default value), or 2 (high debug messages). Note that setting this value to 2 may slow down your program since more debug tests are made by the library (particularly to check if pixel access is made outside image boundaries). See also CImgException to better understand how debug messages are working.

- `cimg_lapack` : This variable tells the library to use the LAPACK library. It can be defined or not defined (default). Define this variable if you want to use CImg-specific functions based on the LAPACK library. You will have to link your code with the LAPACK library to be able to run your program.

- `cimg_convert_path` : This variables tells the library where the ImageMagick's convert tool is located. Setting this variable should not be necessary if ImageMagick is installed on a standart directory, or if convert is in your system PATH variable. This macro should be defined only if the ImageMagick's convert tool is not found automatically, when trying to read compressed image format (GIF,PNG,...). See also cimg_library::CImg::load_convert() and cimg_library::CImg::save_convert() for more informations.

- `cimg_temporary_path` : This variable tells the library where it can find a directory to store temporary files. Setting this variable should not be necessary if you are running on a standart system. This macro should be defined only when troubles are encountered when trying to read compressed image format (GIF,PNG,...). See also cimg_library::CImg::load_convert() and cimg_library::CImg::save_convert() for more informations.

All these compilation variables can be checked, using the function cimg_library::cimg::info(), which displays a list of the different configuration variables and their values on the standart error output.