C++ Template Image Processing Library. |
[Introduction]- [News]- [Download]- [Screenshots]- [Tutorial]- [Forums-Eng]- [Forums-Fr]- [Reference]- [SourceForge Repository ]

- Main Page
- Modules
- Namespaces
- Classes

# 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 1 (Unix), 2 (Windows), or 0 (Other configuration). It should be actually auto-detected by the CImg library. If this is not the case (`cimg_OS=0`), 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_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 standard 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::get_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 standard 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::get_load_convert() and cimg_library::CImg::save_convert() for more informations.

- `cimg_plugin` : This variable tells the library to use a plugin file to add features to the CImg<T> class. Define it with the path of your plugin file, if you want to add member functions to the CImg<T> class, without having to modify directly the `"CImg.h"` file. An include of the plugin file is performed in the CImg<T> class. If `cimg_plugin` if not specified (default), no include is done.

- `cimgl_plugin` : Same as `cimg_plugin`, but to add features to the CImgl<T> class.

- `cimgdisplay_plugin` : Same as `cimg_plugin`, but to add features to the CImgDisplay<T> class.

- `cimgstats_plugin` : Same as `cimg_plugin`, but to add features to the CImgStats<T> class.

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 standard error output.
The CImg Library - C++ Template Image Processing Library