Enumerations | Functions

Image Conversion
[imImage]

Collaboration diagram for Image Conversion:

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, IM_CAST_USER }

Functions

int imConvertDataType (const imImage *src_image, imImage *dst_image, int cpx2real, float gamma, int absolute, 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 absolute, int cast_mode)
void * imImageGetOpenGLData (const imImage *image, int *glformat)
imImageimImageCreateFromOpenGLData (int width, int height, int glformat, const void *gldata)

Detailed Description

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

Enumeration Type Documentation

Complex to real conversions

Predefined Gamma factors. Gamma can be any real number. When gamma<0 use logarithmic, when gamma>0 use exponential. gamma(x,g) = ((e^(g*x))-1)/(exp(g)-1) gamma(x,g) = (log((g*x)+1))/(log(g+1))

enum imCastMode

Predefined Cast Modes
See also Color Manipulation Color Manipulation, Color Component Intervals section.

Enumerator:
IM_CAST_MINMAX 

scan for min and max values.

IM_CAST_FIXED 

use predefined min-max values.

IM_CAST_DIRECT 

direct type cast the value.

IM_CAST_USER 

user attributes called "UserMin" and "UserMax", both float values.


Function Documentation

int imConvertDataType ( const imImage src_image,
imImage dst_image,
int  cpx2real,
float  gamma,
int  absolute,
int  cast_mode 
)

Changes the image data type, using a complex2real conversion, a gamma factor, and an absolute mode (modulus).
When demoting the data type the function will scan source for min/max values or use fixed values (cast_mode) to scale the result according to the target range.
Except complex to real that will use only the complex2real conversion.
Images must be of the same size and color mode. If data type is the same nothing is done.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also imErrorCodes.
See also imDataType, Data Type Utilities, imComplex2Real, imGammaFactor and imCastMode.

im.ConvertDataType(src_image: imImage, dst_image: imImage, cpx2real: number, gamma: number, absolute: boolean, cast_mode: number) -> error: number [in Lua 5] 
im.ConvertDataTypeNew(image: imImage, data_type: number, cpx2real: number, gamma: number, absolute: boolean, cast_mode: number) -> error: number, new_image: imImage  [in Lua 5] 
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. If color mode is the same nothing is done.
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.
Alpha channel is considered and Transparency* attributes are converted to alpha channel.
All other color space conversions assume sRGB and CIE definitions, see Color Manipulation.
Returns IM_ERR_NONE, IM_ERR_DATA or IM_ERR_COUNTER, see also imErrorCodes.
See also imColorSpace, imColorModeConfig and Color Mode Utilities.

im.ConvertColorSpace(src_image: imImage, dst_image: imImage) -> error: number [in Lua 5] 
im.ConvertColorSpaceNew(image: imImage, color_space: number, has_alpha: boolean) -> error: number, new_image: imImage [in Lua 5] 
int imConvertToBitmap ( const imImage src_image,
imImage dst_image,
int  cpx2real,
float  gamma,
int  absolute,
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, see also imErrorCodes. See also imImageIsBitmap, imComplex2Real, imGammaFactor and imCastMode.
The function im.ConvertToBitmapNew uses the default conversion result from imColorModeToBitmap if color_space is nil.

im.ConvertToBitmap(src_image: imImage, dst_image: imImage, cpx2real: number, gamma: number, absolute: boolean, cast_mode: number) -> error: number [in Lua 5] 
im.ConvertToBitmapNew(image: imImage, color_space: number, has_alpha: boolean, cpx2real: number, gamma: number, absolute: boolean, cast_mode: number) -> error: number, new_image: imImage [in Lua 5] 
void* imImageGetOpenGLData ( const imImage image,
int *  glformat 
)

Returns an OpenGL compatible data buffer. Also returns the correspondent pixel format.
The memory allocated is stored in the attribute "GLDATA" with BYTE type. And it will exists while the image exists.
It can be cleared by setting the attribute to NULL.
MAP images are converted to RGB, and BINARY images are converted to GRAY. Alpha channel is considered and Transparency* attributes are converted to alpha channel. So calculate depth from glformat, not from image depth.

image:GetOpenGLData() -> gldata: userdata, glformat: number [in Lua 5] 
imImage* imImageCreateFromOpenGLData ( int  width,
int  height,
int  glformat,
const void *  gldata 
)

Creates an image from an OpenGL data.

im.ImageCreateFromOpenGLData(width, height, glformat: number, gldata: userdata) -> image: imImage [in Lua 5]