NAME

constitute - Methods to Constitute an Image


SYNOPSIS

Image * ConstituteImage( const unsigned int width, const unsigned int height, const char *map, const StorageType type, const void *pixels, ExceptionInfo *exception );

unsigned int DispatchImage( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows, const char *map, const StorageType type, void *pixels );

Image * PingImage( const ImageInfo *image_info, ExceptionInfo *exception );

Image * ReadImage( const ImageInfo *image_info, ExceptionInfo *exception );

unsigned int WriteImage( const ImageInfo *image_info, Image *image );


FUNCTION DESCRIPTIONS

ConstituteImage

ConstituteImage returns an image from the the pixel data you supply. The pixel data must be in scanline order top-to-bottom. The data can be char, short int, int, float, or double. Float and double require the pixels to be normalized [0..1], otherwise [0..MaxRGB]. For example, to create a 640x480 image from unsigned red-green-blue character data, use

image=ConstituteImage ( 640, 480, "RGB", CharPixel, pixels, &exception );;

The format of the Constitute method is:

Image *ConstituteImage ( const unsigned int width, const unsigned int height, const char *map, const StorageType type, const void *pixels, ExceptionInfo *exception );

A description of each parameter follows:

image:
ConstituteImage returns a pointer to the image. A null image is returned if there is a memory shortage or if the image cannot be read.

width:
width in pixels of the image.

height:
height in pixels of the image.

map:
This string reflects the expected ordering of the pixel array. It can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, K = black, or I = intensity (for grayscale).

type:
Define the data type of the pixels. Float and double types are expected to be normalized [0..1] otherwise [0..MaxRGB]. Choose from these types: CharPixel, ShortPixel, IntegerPixel, FloatPixel, or DoublePixel.

pixels:
This array of values contain the pixel components as defined by map and type. You must preallocate this array where the expected length varies depending on the values of width, height, and type.

exception:
Return any errors or warnings in this structure.

DispatchImage

DispatchImage extracts pixel data from an image and returns it to you. The method returns False on success otherwise True if an error is encountered. The data is returned as char, short int, int, float, or double in the order specified by map. Suppose we want want to extract the first scanline of a 640x480 image as character data in red-green-blue order:

DispatchImage ( image, 0, 0, 640, 1, "RGB", 0, pixels );;

The format of the DispatchImage method is:

unsigned int DispatchImage ( Image *image, const int x, const int y, const unsigned int columns, const unsigned int rows, const char *map, const StorageType type, void *pixels );

A description of each parameter follows:

image:
The image.

x, y, columns, rows:
These values define the perimeter of a region of pixels you want to extract.

map:
This string reflects the expected ordering of the pixel array. It can be any combination or order of R = red, G = green, B = blue, A = alpha, C = cyan, Y = yellow, M = magenta, K = black, or I = intensity (for grayscale).

type:
Define the data type of the pixels. Float and double types are normalized to [0..1] otherwise [0..MaxRGB]. Choose from these types: CharPixel, ShortPixel, IntegerPixel, FloatPixel, or DoublePixel.

pixels:
This array of values contain the pixel components as defined by map and type. You must preallocate this array where the expected length varies depending on the values of width, height, and type.

PingImage

PingImage is a convenience method that returns information about an image without having to read the image into memory. It returns the width, height, file size in bytes, and the file format of the image. For an image sequence, only the information for the first image in the sequence is returned.

PingImage returns an Image on success and NULL if the image cannot be pinged. The image does not contain any pixel data.

The format of the PingImage method is:

Image *PingImage ( const ImageInfo *image_info, ExceptionInfo *exception );

A description of each parameter follows:

image_info:
Ping the image defined by the file or filename members of this structure.

exception:
Return any errors or warnings in this structure.

ReadImage

ReadImage reads an image or image sequence from a file or file handle. The method returns a NULL if there is a memory shortage or if the image cannot be read.

The format of the ReadImage method is:

Image *ReadImage ( const ImageInfo *image_info, ExceptionInfo *exception );

A description of each parameter follows:

image_info:
Read the image defined by the file or filename members of this structure.

exception:
Return any errors or warnings in this structure.

WriteImage

Write allows you to write a single or image or a sequence to a file or filehandle. Write returns a value other than 0 if the image is written. If 0 is returned, check the exception member of image to determine why the image failed to write.

The format of the WriteImage method is:

unsigned int WriteImage ( const ImageInfo *image_info, Image *image );

A description of each parameter follows:

image_info:
Write the image defined by the file or filename members of this structure.

image:
A pointer to a Image structure.