- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- ConstituteImage
- DestroyConstitute
- ExportImagePixels
- ImportImagePixels
- PingImage
- PopImagePixels
- PushImagePixels
- ReadImage
- ReadInlineImage
- WriteImage
- WriteImages

# NAME

constitute - Constitute an Image

# SYNOPSIS

Image * ConstituteImage( const unsigned long columns, const unsigned long rows, const char *map, const StorageType storage, const void *pixels, ExceptionInfo *exception );

DestroyConstitute( void );

MagickBooleanType ExportImagePixels( const Image *image, const long x_offset, const long y_offset, const unsigned long columns, const unsigned long rows, const char *map, const StorageType type, void *pixels, ExceptionInfo *exception );

MagickBooleanType ImportImagePixels( Image *image, const long x_offset, const long y_offset, const unsigned long columns, const unsigned long rows, const char *map, const StorageType type, const void *pixels );

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

MagickBooleanType PopImagePixels( Image *, const QuantumType quantum, unsigned char *destination );

MagickBooleanType PushImagePixels( Image *image, const QuantumType quantum, const unsigned char *source );

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

Image * ReadInlineImage( const ImageInfo *image_info, const char *content, ExceptionInfo *exception );

MagickBooleanType WriteImage( const ImageInfo *image_info, Image *image );

MagickBooleanType WriteImages( const ImageInfo *image_info, Image *image, const char *filename, ExceptionInfo *exception );

# 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 long columns, const unsigned long rows, const char *map, const StorageType storage, const void *pixels, ExceptionInfo *exception );

A description of each parameter follows:

columns:
  width in pixels of the image.

rows:
  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 (0 is transparent), O = opacity (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad.

storage:
  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, LongPixel, 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, map, and type.

exception:
  Return any errors or warnings in this structure.

## DestroyConstitute

> DestroyConstitute() destroys the constitute environment.

The format of the DestroyConstitute method is:

> DestroyConstitute ( void );

## ExportImagePixels

> ExportImagePixels() extracts pixel data from an image and returns it to you. The method returns MagickTrue on success otherwise MagickFalse if an error is encountered. The data is returned as char, short int, int, long, float, or double in the order specified by map.

Suppose you want to extract the first scanline of a 640x480 image as character data in red-green-blue order:

> ExportImagePixels ( image, 0, 0, 640, 1, "RGB", CharPixel, pixels, exception );;

The format of the ExportImagePixels method is:

> MagickBooleanType ExportImagePixels ( const Image *image, const long x_offset, const long y_offset, const unsigned long columns, const unsigned long rows, const char *map, const StorageType type, void *pixels, ExceptionInfo *exception );

A description of each parameter follows:

image:
  The image.

x_offset, y_offset, 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 (0 is transparent), O = opacity (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad.

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, LongPixel, 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, map, and type.

exception:
  Return any errors or warnings in this structure.

## ImportImagePixels

> ImportImagePixels() accepts pixel data and stores in the image at the location you specify. The method returns MagickTrue on success otherwise MagickFalse if an error is encountered. The pixel data can be either char, short int, int, long, float, or double in the order specified by map.

Suppose your want want to upload the first scanline of a 640x480 image from character data in red-green-blue order:

> ImportImagePixels ( image, 0, 0, 640, 1, "RGB", CharPixel, pixels );;

The format of the ImportImagePixels method is:

> MagickBooleanType ImportImagePixels ( Image *image, const long x_offset, const long y_offset, const unsigned long columns, const unsigned long rows, const char *map, const StorageType type, const void *pixels );

A description of each parameter follows:

image:
  The image.

x_offset, y_offset, columns, rows:
  These values define the perimeter of a region of pixels you want to define.

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 (0 is transparent), O = opacity (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad.

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, LongPixel, 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, map, and type.

## PingImage

> PingImage() returns all the attributes of an image or image sequence except for the pixels. It is much faster and consumes far less memory than ReadImage ( ) . On failure, a NULL image is returned and exception describes the reason for the failure.

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.

## PopImagePixels

> PopImagePixels() transfers one or more pixel components from the image pixel cache to a user supplied buffer. The pixels are returned in network byte order. MagickTrue is returned if the pixels are successfully transferred, otherwise MagickFalse.

The format of the PopImagePixels method is:

> MagickBooleanType PopImagePixels ( Image *, const QuantumType quantum, unsigned char *destination );

A description of each parameter follows:

image:
  The image.

quantum:
  Declare which pixel components to transfer (RGB, RGBA, etc).

destination:
  The components are transferred to this buffer.

## PushImagePixels

> PushImagePixels() transfers one or more pixel components from a user supplied buffer into the image pixel cache of an image. The pixels are expected in network byte order. It returns MagickTrue if the pixels are successfully transferred, otherwise MagickFalse.

The format of the PushImagePixels method is:

> MagickBooleanType PushImagePixels ( Image *image, const QuantumType quantum, const unsigned char *source );

A description of each parameter follows:

image:
  The image.

quantum:
  Declare which pixel components to transfer (red, green, blue, opacity, RGB, or RGBA).

source:
  The pixel components are transferred from this buffer.

## 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. On failure, a NULL image is returned and exception describes the reason for the failure.

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.

## ReadInlineImage

> ReadInlineImage() reads a Base64-encoded inline image or image sequence. The method returns a NULL if there is a memory shortage or if the image cannot be read. On failure, a NULL image is returned and exception describes the reason for the failure.

The format of the ReadInlineImage method is:

> Image *ReadInlineImage ( const ImageInfo *image_info, const char *content, ExceptionInfo *exception );

A description of each parameter follows:

image_info:
  The image info.

content:
  The image encoded in Base64.

exception:
  Return any errors or warnings in this structure.

## WriteImage

Use `Write()` to write an image or an image sequence to a file or filehandle. If writing to a file on disk, the name is defined by the filename member of the image structure. `Write()` returns 0 is there is a memory shortage or if the image cannot be written. Check the exception member of image to determine the cause for any failure.

The format of the WriteImage method is:

> MagickBooleanType WriteImage ( const ImageInfo *image_info, Image *image );

A description of each parameter follows:

image_info:
  The image info.

image:
  The image.

## WriteImages

> WriteImages() writes an image sequence.

The format of the WriteImages method is:

> MagickBooleanType WriteImages ( const ImageInfo *image_info, Image *image, const char *filename, ExceptionInfo *exception );

A description of each parameter follows:

image_info:
  The image info.

images:
  The image list.

filename:
  The image filename.

exception:
  Return any errors or warnings in this structure.

"Image manipulation software that works like magick"