NAME

image - ImageMagick Image Methods


SYNOPSIS

allocated_image=AllocateImage(image_info)

AllocateNextImage(image_info,image)

status=AnimateImages(image_info,image)

AppendImages(images,stack)

averaged_image=AverageImages(images)

blob=BlobImage(image_info,image,length)

clone_image=CloneImage(image,columns,rows,clone_pixels)

cloned_info=CloneImageInfo(image_info)

CloseImage(image)

CommentImage(image,comments)

CompositeImage(image,compose,composite_image,x_offset,y_offset)

CompressColormap(image)

CondenseImage(image)

image=CreateImage(width,height,red,green,blue,opacity)

CycleColormapImage(image,amount)

DescribeImage(image,file,verbose)

DestroyImage(image)

DestroyImageInfo(image_info)

DestroyImages(image)

status=DisplayImages(image_info,image)

GetImageInfo(image_info)

type=GetImageType(image)

scenes=GetNumberScenes(image)

GetPixels(image,red_pixels,green_pixels,blue_pixels,opacity_pixels)

status=IsGeometry(geometry)

status=IsGrayImage(image)

status=IsMonochromeImage(image)

status=IsSubimage(geometry,pedantic)

status=IsTainted(image)

LabelImage(image,label)

LayerImage(image,layer)

images=ListToGroupImage(images,number_images)

MatteImage(image)

MogrifyImage(image_info,argc,argv,image)

MogrifyImages(image_info,argc,argv,images)

OpenImage(image_info,image,type)

flags=ParseImageGeometry(image_geometry,x,y,width,height)

image=PingImage(image_info)

RGBTransformImage(image,colorspace)

image=ReadImage(image_info)

image=ReadImages(image_info)

SetImage(image)

SetImageInfo(image_info,rectify)

SyncImage(image)

TextureImage(image,texture)

TransformImage(image,crop_geometry,image_geometry)

TransformRGBImage(image,colorspace)

TransparentImage(image,color)

status=WriteImage(image_info,image)


FUNCTION DESCRIPTIONS


AllocateImage

Method AllocateImage allocates an Image structure and initializes each field to a default value.

The format of the AllocateImage routine is:

        allocated_image=AllocateImage(image_info)

A description of each parameter follows:

allocated_image:

Method AllocateImage returns a pointer to an image structure initialized to default values. A null image is returned if there is a memory shortage.

image_info:

Specifies a pointer to an ImageInfo structure.


AllocateNextImage

Method AllocateNextImage allocates an Image structure and initializes each field to a default value.

The format of the AllocateNextImage routine is:

        AllocateNextImage(image_info,image)

A description of each parameter follows:

image_info:

Specifies a pointer to an ImageInfo structure.

image:

The address of a structure of type Image.


AnimateImages

Method AnimateImages displays one or more images to an X window.

The format of the AllocateNextImage routine is:

        status=AnimateImages(image_info,image)

A description of each parameter follows:

status:

Method DisplayImages returns True if the images are displayed in an X window, otherwise False is returned.

image_info:

Specifies a pointer to an ImageInfo structure.

image:

The address of a structure of type Image.


AppendImages

Method AppendImages appends a set of images. All the input images must have the same width or height. Images of the same width are stacked top-to-bottom. Images of the same height are stacked left-to-right. If the stack is false, rectangular images are stacked left-to-right otherwise top-to-bottom.

The format of the AppendImage routine is:

        AppendImages(images,stack)

A description of each parameter follows:

images:

The address of a structure of type Image; returned from ReadImage.

stack:

An unsigned value other than stacks rectangular images top-to-bottom otherwise left-to-right.


AverageImages

Method AverageImages averages a set of images. All the input images must be the same size in pixels.

The format of the AverageImage routine is:

        averaged_image=AverageImages(images)

A description of each parameter follows:

averaged_image:

Method AverageImages returns the mean pixel value for an image sequence.

images:

The address of a structure of type Image; returned from ReadImage.


BlobImage

Method BlobImage implements direct to memory image formats. It returns the image as a blob and its length.

The format of the BlobImage routine is:

        blob=BlobImage(image_info,image,length)

A description of each parameter follows:

blob:

Method BlobImage returns a chunk of memory written in the desired image format (e.g. JPEG, GIF, etc.). If an error occurs NULL is returned.

image_info:

Specifies a pointer to an ImageInfo structure.

image:

The address of a structure of type Image.

length:

This pointer to an unsigned long is set to the length of the image blob.


CloneImage

Method CloneImage returns a copy of all fields of the input image. The the pixel memory is allocated but the pixel data is not copied.

The format of the CloneImage routine is:

        clone_image=CloneImage(image,columns,rows,clone_pixels)

A description of each parameter follows:

clone_image:

Method CloneImage returns a pointer to the image after copying. A null image is returned if there is a memory shortage.

image:

The address of a structure of type Image.

columns:

An integer that specifies the number of columns in the copied image.

rows:

An integer that specifies the number of rows in the copied image.

clone_pixels:

Specifies whether the pixel data is copied. Must be either True or False;


CloneImageInfo

Method CloneImageInfo makes a duplicate of the given image info, or if image info is NULL, a new one.

The format of the CloneImageInfo routine is:

        cloned_info=CloneImageInfo(image_info)

A description of each parameter follows:

cloned_info:

Method CloneImageInfo returns a duplicate of the given image info, or if image info is NULL a new one.

image_info:

a structure of type info.


CloseImage

Method CloseImage closes a file associated with the image. If the filename prefix is '|', the file is a pipe and is closed with PipeClose.

The format of the CloseImage routine is:

        CloseImage(image)

A description of each parameter follows:

image:

The address of a structure of type Image.


CommentImage

Method CommentImage initializes an image comment. Optionally the comment can include the image filename, type, width, height, or scene number by embedding special format characters.

The format of the CommentImage routine is:

        CommentImage(image,comments)

A description of each parameter follows:

image:

The address of a structure of type Image.

comments:

The address of a character string containing the comment format.


CompressColormap

Method CompressColormap compresses an image colormap removing any duplicate and unused color entries.

The format of the CompressColormap routine is:

        CompressColormap(image)

A description of each parameter follows:

image:

The address of a structure of type Image.


CompositeImage

Method CompositeImage returns the second image composited onto the first at the specified offsets.

The format of the CompositeImage routine is:

        CompositeImage(image,compose,composite_image,x_offset,y_offset)

A description of each parameter follows:

image:

The address of a structure of type Image.

compose:

Specifies an image composite operator.

composite_image:

The address of a structure of type Image.

x_offset:

An integer that specifies the column offset of the composited image.

y_offset:

An integer that specifies the row offset of the composited image.


CondenseImage

Method CondenseImage compresses an image to the minimum number of runlength-encoded packets.

The format of the CondenseImage routine is:

        CondenseImage(image)

A description of each parameter follows:

image:

The address of a structure of type Image.


CreateImage

Method CreateImage creates an image from the specified normalized pixel data and returns it. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

The format of the CreateImage routine is:

        image=CreateImage(width,height,red,green,blue,opacity)

A description of each parameter follows:

image:

Method CreateImage returns a pointer to the image after reading. A null image is returned if there is a memory shortage or if the image cannot be read.

width:

Specifies the width in pixels of the image.

height:

Specifies the height in pixels of the image.

red,green,blue,opacity:

This array of normalized float values [0..1] contain the red, green, blue, and opacity components of the pixel data. The length of the arrays must equal the area specified by the width and height values. If you do not want to initialize a particular component, specify it as NULL.


CycleColormapImage

Method CycleColormapImage cycles the image colormap by a specified amount.

The format of the CycleColormapImage routine is:

        CycleColormapImage(image,amount)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.

amount:

An unsigned value that specifies the offset of the colormap.


DescribeImage

Method DescribeImage describes an image by printing its attributes to stdout.

The format of the DescribeImage routine is:

        DescribeImage(image,file,verbose)

A description of each parameter follows:

image:

The address of a structure of type Image.

file:

send the image attributes to this file.

verbose:

an unsigned value other than zero prints detailed information about the image.


DestroyImage

Method DestroyImage deallocates memory associated with an image.

The format of the DestroyImage routine is:

        DestroyImage(image)

A description of each parameter follows:

image:

The address of a structure of type Image.


DestroyImageInfo

Method DestroyImageInfo deallocates memory associated with an ImageInfo structure.

The format of the DestroyImageInfo routine is:

        DestroyImageInfo(image_info)

A description of each parameter follows:

image_info:

Specifies a pointer to an ImageInfo structure.


DestroyImages

Method DestroyImages deallocates memory associated with a linked list of images.

The format of the DestroyImages routine is:

        DestroyImages(image)

A description of each parameter follows:

image:

The address of a structure of type Image.


DisplayImages

Method DisplayImages displays one or more images to an X window.

The format of the AllocateNextImage routine is:

        status=DisplayImages(image_info,image)

A description of each parameter follows:

status:

Method DisplayImages returns True if the images are displayed in an X window, otherwise False is returned.

image_info:

Specifies a pointer to an ImageInfo structure.

image:

The address of a structure of type Image.


GetImageInfo

Method GetImageInfo initializes the ImageInfo structure.

The format of the GetImageInfo routine is:

        GetImageInfo(image_info)

A description of each parameter follows:

image_info:

Specifies a pointer to an ImageInfo structure.


GetImageType

Method GetImageType returns the type of image (e.g. bilevel, palette, etc).

The format of the GetImageType routine is:

        type=GetImageType(image)

A description of each parameter follows:

type:

Method GetImageType returns a ImageType enum that specifies the type of the specified image (e.g. bilevel, palette, etc).

image:

The address of a structure of type Image.


GetNumberScenes

Method GetNumberScenes returns the number of scenes in an image sequence.

The format of the GetNumberScenes routine is:

        scenes=GetNumberScenes(image)

A description of each parameter follows:

scenes:

Method GetNumberScenes returns the number of scenes in an image sequence.

image:

The address of a structure of type Image.


GetPixels

Method GetPixels returns the pixel data of an image as normalized red, green, blue, and opacity values.

The format of the GetPixels routine is:

        GetPixels(image,red_pixels,green_pixels,blue_pixels,opacity_pixels)

A description of each parameter follows:

image:

Specifies a pointer to a Image structure; returned from ReadImage.

red_pixels,green_pixels,blue_pixels,opacity_pixels:

These arrays are returned with the correpondingred, green, blue, and opacity values from the image. The length of the arrays must equal the area specified by the columns and row values values of the Image structure. If you do not want to initialize a particular component, specify it as NULL.


IsGeometry

Method IsGeometry returns True if the geometry specification is valid as determined by ParseGeometry.

The format of the IsGeometry routine is:

        status=IsGeometry(geometry)

A description of each parameter follows:

status:

Method IsGeometry returns True if the geometry specification is valid otherwise False is returned.

geometry:

This string is the geometry specification.


IsGrayImage

Method IsGrayImage returns True if the image is grayscale otherwise False is returned. If the image is DirectClass and grayscale, it is demoted to PseudoClass.

The format of the IsGrayImage routine is:

        status=IsGrayImage(image)

A description of each parameter follows:

status:

Method IsGrayImage returns True if the image is grayscale otherwise False is returned.

image:

The address of a structure of type Image; returned from ReadImage.


IsMonochromeImage

Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned. If the image is DirectClass and monochrome, it is demoted to PseudoClass.

The format of the IsMonochromeImage routine is:

        status=IsMonochromeImage(image)

A description of each parameter follows:

status:

Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned.

image:

The address of a structure of type Image; returned from ReadImage.


IsSubimage

Method IsSubimage returns True if the geometry is a valid subimage specification (e.g. [1], [1-9], [1,7,4]).

The format of the IsSubimage routine is:

        status=IsSubimage(geometry,pedantic)

A description of each parameter follows:

status:

Method IsSubimage returns True if the geometry is a valid subimage specification otherwise False is returned.

geometry:

This string is the geometry specification.

pedantic:

A value other than 0 invokes a more restriction set of conditions for a valid specification (e.g. [1], [1-4], [4-1]).


IsTainted

Method IsTainted returns True if the image has been altered since it was first read or if any image in the sequence has a difference magic or filename.

The format of the IsTainted routine is:

        status=IsTainted(image)

A description of each parameter follows:

status:

Method IsTainted returns True if the image has been altered since it was first read.

image:

The address of a structure of type Image.


LabelImage

Method LabelImage initializes an image label. Optionally the label can include the image filename, type, width, height, or scene number by embedding special format characters.

The format of the LabelImage routine is:

        LabelImage(image,label)

A description of each parameter follows:

image:

The address of a structure of type Image.

label:

The address of a character string containing the label format.


LayerImage

Method LayerImage extracts the specified layer from the references image.

The format of the LayerImage routine is:

        LayerImage(image,layer)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.

layer:

A value of type LayerType that identifies which layer to extract.


ListToGroupImage

Method ListToGroupImage converts a linked list of images to a sequential array.

The format of the ListToGroupImage routine is:

        images=ListToGroupImage(images,number_images)

A description of each parameter follows:

images:

Method ListToGroupImage converts a linked list of images to a sequential array and returns the array..

images:

The address of a structure of type Image; returned from ReadImage.

number_images:

A pointer to an unsigned integer. The number of images in the image array is returned here.


MatteImage

Method MatteImage initializes the matte channel of the reference image to opaque.

The format of the MatteImage routine is:

        MatteImage(image)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.


MogrifyImage

Method MogrifyImage applies image processing options to an image as prescribed by command line options.

The format of the MogrifyImage routine is:

        MogrifyImage(image_info,argc,argv,image)

A description of each parameter follows:

image_info:

Specifies a pointer to an ImageInfo structure.

argc:

Specifies a pointer to an integer describing the number of elements in the argument vector.

argv:

Specifies a pointer to a text array containing the command line arguments.

image:

The address of a structure of type Image; returned from ReadImage.


MogrifyImages

Method MogrifyImages applies image processing options to a sequence of images as prescribed by command line options.

The format of the MogrifyImage routine is:

        MogrifyImages(image_info,argc,argv,images)

A description of each parameter follows:

image_info:

Specifies a pointer to an ImageInfo structure.

argc:

Specifies a pointer to an integer describing the number of elements in the argument vector.

argv:

Specifies a pointer to a text array containing the command line arguments.

images:

The address of a structure of type Image; returned from ReadImage.


OpenImage

Method OpenImage open a file associated with the image. A file name of '-' sets the file to stdin for type 'r' and stdout for type 'w'. If the filename suffix is '.gz' or '.Z', the image is decompressed for type 'r' and compressed for type 'w'. If the filename prefix is '|', it is piped to or from a system command.

The format of the OpenImage routine is:

        OpenImage(image_info,image,type)

A description of each parameter follows:

image_info:

Specifies a pointer to an ImageInfo structure.

image:

The address of a structure of type Image.

type:

'r' for reading; 'w' for writing.


ParseImageGeometry

Method ParseImageGeometry parses a geometry specification and returns the width, height, x, and y values. It also returns flags that indicates which of the four values (width, height, xoffset, yoffset) were located in the string, and whether the x and y values are negative. In addition,

The format of the ParseImageGeometry routine is:

        flags=ParseImageGeometry(image_geometry,x,y,width,height)

A description of each parameter follows:

flags:

Method ParseImageGeometry returns a bitmask that indicates which of the four values were located in the geometry string.

image_geometry:

Specifies a character string representing the geometry specification.

x,y:

A pointer to an integer. The x and y offset as determined by the geometry specification is returned here.

width,height:

A pointer to an unsigned integer. The width and height as determined by the geometry specification is returned here.


PingImage

Method PingImage returns the image size in bytes if it exists and can be the image is returned as well. Note, only the first image in a multi-frame image file is pinged.

The format of the PingImage routine is:

        image=PingImage(image_info)

A description of each parameter follows:

Image:

Method PingImage returns the image size in bytes if the image file exists and it size can be determined otherwise 0.

image_info:

Specifies a pointer to an ImageInfo structure.


ReadImage

Method ReadImage reads an image and returns it. It allocates the memory necessary for the new Image structure and returns a pointer to the new image. By default, the image format is determined by its magic number. To specify a particular image format, precede the filename with an explicit image format name and a colon (i.e. ps:image) or as the filename suffix (i.e. image.ps).

The format of the ReadImage routine is:

        image=ReadImage(image_info)

A description of each parameter follows:

image:

Method ReadImage returns a pointer to the image after reading. A null image is returned if there is a memory shortage or if the image cannot be read.

image_info:

Specifies a pointer to an ImageInfo structure.


ReadImages

Method ReadImages reads a list of image names from a file and then returns the images as a linked list.

The format of the ReadImage routine is:

        image=ReadImages(image_info)

A description of each parameter follows:

image:

Method ReadImage returns a pointer to the image after reading. A null image is returned if there is a memory shortage or if the image cannot be read.

image_info:

Specifies a pointer to an ImageInfo structure.


RGBTransformImage

Method RGBTransformImage converts the reference image from RGB to an alternate colorspace. The transformation matrices are not the standard ones: the weights are rescaled to normalized the range of the transformed values to be [0..MaxRGB].

The format of the RGBTransformImage routine is:

        RGBTransformImage(image,colorspace)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.

colorspace:

An unsigned integer value that indicates which colorspace to transform the image.


SetImage

Method SetImage initializes the reference image to the background color.

The format of the SetImage routine is:

        SetImage(image)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.


SetImageInfo

Method SetImageInfo initializes the `magick' field of the ImageInfo structure. It is set to a type of image format based on the prefix or suffix of the filename. For example, `ps:image' returns PS indicating a Postscript image. JPEG is returned for this filename: `image.jpg'. The filename prefix has precendence over the suffix. Use an optional index enclosed in brackets after a file name to specify a desired subimage of a multi-resolution image format like Photo CD (e.g. img0001.pcd[4]).

The format of the SetImageInfo routine is:

        SetImageInfo(image_info,rectify)

A description of each parameter follows:

image_info:

Specifies a pointer to an ImageInfo structure.

rectify:

an unsigned value other than zero rectifies the attribute for multi-frame support (user may want multi-frame but image format may not support it).


SortColormapByIntentsity

Method SortColormapByIntensity sorts the colormap of a PseudoClass image by decreasing color intensity.

The format of the SortColormapByIntensity routine is:

    SortColormapByIntensity(image)

A description of each parameter follows:

image:

A pointer to a Image structure.


SyncImage

Method SyncImage initializes the red, green, and blue intensities of each pixel as defined by the colormap index.

The format of the SyncImage routine is:

        SyncImage(image)

A description of each parameter follows:

image:

The address of a structure of type Image.


TextureImage

Method TextureImage layers a texture onto the background of an image.

The format of the TextureImage routine is:

        TextureImage(image,texture)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.

texture:

This image contains the texture to layer on the background.


TransformImage

Method TransformImage creates a new image that is a transformed size of of existing one as specified by the crop and image geometries. It allocates the memory necessary for the new Image structure and returns a pointer to the new image.

If a crop geometry is specified a subregion of the image is obtained. If the specified image size, as defined by the image and scale geometries, is smaller than the actual image size, the image is first minified to an integral of the specified image size with an antialias digital filter. The image is then scaled to the exact specified image size with pixel replication. If the specified image size is greater than the actual image size, the image is first enlarged to an integral of the specified image size with bilinear interpolation. The image is then scaled to the exact specified image size with pixel replication.

The format of the TransformImage routine is:

        TransformImage(image,crop_geometry,image_geometry)

A description of each parameter follows:

image:

The address of an address of a structure of type Image. The transformed image is returned as this parameter.

crop_geometry:

Specifies a pointer to a crop geometry string. This geometry defines a subregion of the image.

image_geometry:

Specifies a pointer to a image geometry string. The specified width and height of this geometry string are absolute.


TransformRGBImage

Method TransformRGBImage converts the reference image from an alternate colorspace. The transformation matrices are not the standard ones: the weights are rescaled to normalized the range of the transformed values to be [0..MaxRGB].

The format of the TransformRGBImage routine is:

        TransformRGBImage(image,colorspace)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.

colorspace:

An unsigned integer value that indicates the colorspace the image is currently in. On return the image is in the RGB color space.


TransparentImage

Method TransparentImage creates a matte image associated with the image. All pixel locations are initially set to opaque. Any pixel that matches the specified color are set to transparent.

The format of the TransparentImage routine is:

        TransparentImage(image,color)

A description of each parameter follows:

image:

The address of a structure of type Image; returned from ReadImage.

color:

A character string that contain an X11 color string.


UncompressImage

Method UncondenseImage uncompresses runlength-encoded pixels packets to a rectangular array of pixels.

The format of the UncondenseImage routine is:

    status=UncondenseImage(image)

A description of each parameter follows:

status:

Method UncondenseImage returns True if the image is uncompressed otherwise False.

image:

The address of a structure of type Image.


WriteImage

Method WriteImage writes an image to a file as defined by image->filename. You can specify a particular image format by prefixing the file with the image type and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). The image may be modified to adapt it to the requirements of the image format. For example, DirectClass images must be color-reduced to PseudoClass if the format is GIF.

The format of the WriteImage routine is:

        status=WriteImage(image_info,image)

A description of each parameter follows:

status:

Method WriteImage return True if the image is written. False is returned is there is a memory shortage or if the image file fails to write.

image_info:

Specifies a pointer to an ImageInfo structure.

image:

A pointer to a Image structure.