IM: Read Access

IM - Imaging Libray

Read Access
[Image Storage]


Detailed Description

See im.h


Functions

imFileimFileOpen (const char *file_name, int *error)
void imFileGetInfo (imFile *ifile, char *format, char *compression, int *image_count)
void imFileGetPalette (imFile *ifile, long *palette, int *palette_count)
int imFileReadImageInfo (imFile *ifile, int index, int *width, int *height, int *file_color_mode, int *file_data_type)
int imFileReadImageData (imFile *ifile, void *data, int convert2bitmap, int color_mode_flags)

Function Documentation

imFile* imFileOpen const char *  file_name,
int *  error
 

Opens the file for reading. It must exists. Also reads file header.

void imFileGetInfo imFile ifile,
char *  format,
char *  compression,
int *  image_count
 

Returns file information. image_count is the number of images in a stack or the number of frames in a video/animation or the depth of a volume data.
compression and image_count can be NULL.

void imFileGetPalette imFile ifile,
long *  palette,
int *  palette_count
 

Returns the pallete if any.
"palette" must be a 256 colors alocated array.
Returns zero in "palette_count" if there is no palette. "palette_count" is >0 and <=256.

int imFileReadImageInfo imFile ifile,
int  index,
int *  width,
int *  height,
int *  file_color_mode,
int *  file_data_type
 

Reads the image header if any and returns image information.
Reads also the extended image attributes, so other image attributes will be available only after calling this function.
Returns an error code. index specifies the image number between 0 and image_count-1.
Some drivers reads only in sequence, so "index" can be ignored by the format driver.
Any parameters can be NULL. This function must be called at least once, check each format documentation.

int imFileReadImageData imFile ifile,
void *  data,
int  convert2bitmap,
int  color_mode_flags
 

Reads the image data with or without conversion.
The data can be converted to bitmap when reading. Data type conversion to byte will always scan for min-max then scale to 0-255, except integer values that min-max are already between 0-255. Complex to real conversions will use the magnitude.
Color mode flags contains packed, alpha and top-botttom information. If flag is 0 means unpacked, no alpha and bottom up. If flag is -1 the file original flags are used.
Returns an error code.