IM: Image Conversion

IM - Imaging Libray

Image Conversion
[Image Representation]


Detailed Description

Converts one type of image into another. Can convert between color modes and between data types.
See im_convert.h


Enumerations

enum  imComplex2Real { IM_CPX_REAL, IM_CPX_IMAG, IM_CPX_MAG, IM_CPX_PHASE }
enum  imGammaFactor {
  IM_GAMMA_LINEAR = 0, IM_GAMMA_LOGLITE = -10, IM_GAMMA_LOGHEAVY = -1000, IM_GAMMA_EXPLITE = 2,
  IM_GAMMA_EXPHEAVY = 7
}
enum  imCastMode { IM_CAST_MINMAX, IM_CAST_FIXED, IM_CAST_DIRECT }

Functions

int imConvertDataType (const imImage *src_image, imImage *dst_image, int cpx2real, float gamma, int abssolute, int cast_mode)
int imConvertColorSpace (const imImage *src_image, imImage *dst_image)
int imConvertToBitmap (const imImage *src_image, imImage *dst_image, int cpx2real, float gamma, int abssolute, int cast_mode)
void imConvertPacking (const void *src_data, void *dst_data, int width, int height, int depth, int data_type, int src_is_packed)
void imConvertMapToRGB (unsigned char *data, int count, int depth, int packed, long *palette, int palette_count)

Enumeration Type Documentation

enum imComplex2Real
 

Complex to real conversions

00030 {
00031   IM_CPX_REAL, 
00032   IM_CPX_IMAG, 
00033   IM_CPX_MAG, 
00034   IM_CPX_PHASE
00035 };

enum imGammaFactor
 

Predefined Gamma factors

00040 {
00041   IM_GAMMA_LINEAR   = 0,
00042   IM_GAMMA_LOGLITE  = -10,
00043   IM_GAMMA_LOGHEAVY = -1000,
00044   IM_GAMMA_EXPLITE  = 2,
00045   IM_GAMMA_EXPHEAVY = 7
00046 };

enum imCastMode
 

Predefined Cast Modes

Enumeration values:
IM_CAST_MINMAX  scan for min and max values
IM_CAST_FIXED  use predefied 0-max values, see Color Manipulation Color Manipulation.
IM_CAST_DIRECT  direct type cast the value. Only byte and ushort will be cropped.
00051 {
00052   IM_CAST_MINMAX, /**< scan for min and max values */
00053   IM_CAST_FIXED,  /**< use predefied 0-max values, see \ref color Color Manipulation. */
00054   IM_CAST_DIRECT  /**< direct type cast the value. Only byte and ushort will be cropped. */
00055 };


Function Documentation

int imConvertDataType const imImage src_image,
imImage dst_image,
int  cpx2real,
float  gamma,
int  abssolute,
int  cast_mode
 

Changes the image data type, using a complex2real conversion, a gamma factor, and an abssolute mode (modulus).
When demoting the data type the function will scan for min/max values or use fixed values (cast_mode) to scale the result according to the destiny range.
Except complex to real that will use only the complex2real conversion.
Images must be of the same size and color mode.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER.

int imConvertColorSpace const imImage src_image,
imImage dst_image
 

Converts one color space to another. Images must be of the same size and data type.
CMYK can be converted to RGB only, and it is a very simple conversion.
All colors can be converted to Binary, the non zero gray values are converted to 1.
RGB to Map uses the median cut implementation from the free IJG JPEG software, copyright Thomas G. Lane.
All other color space conversions assume sRGB and CIE definitions.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER.

int imConvertToBitmap const imImage src_image,
imImage dst_image,
int  cpx2real,
float  gamma,
int  abssolute,
int  cast_mode
 

Converts the image to its bitmap equivalent, uses imConvertColorSpace and imConvertDataType.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER.

void imConvertPacking const void *  src_data,
void *  dst_data,
int  width,
int  height,
int  depth,
int  data_type,
int  src_is_packed
 

Changes the packing of the data buffer.

void imConvertMapToRGB unsigned char *  data,
int  count,
int  depth,
int  packed,
long *  palette,
int  palette_count
 

Changes in-place a MAP data into a RGB data. The data must have room for the RGB image.
depth can be 3 or 4. count=width*height.
Very usefull for OpenGL applications.