## AcquireMemory

AcquireMemory() returns a pointer to a block of memory at least size bytes suitably aligned for any use.

The format of the AcquireMemory method is:

      void *AcquireMemory(const size_t size)

A description of each parameter follows:

##### size

The size of the memory in bytes to allocate.

## AllocateString

AllocateString() allocates memory for a string and copies the source string to that memory location (and returns it).

The format of the AllocateString method is:

      char *AllocateString(const char *source)

A description of each parameter follows:

##### source

A character string.

## ChannelThresholdImage

ChannelThresholdImage() changes the value of individual pixels based on the intensity of each pixel channel. The result is a high-contrast image.

The format of the ChannelThresholdImage method is:

      unsigned int ChannelThresholdImage(Image *image,const char *level)

A description of each parameter follows:

##### image

The image.

##### level

define the threshold values.

## CloneImageAttributes

CloneImageAttributes() clones one or more image attributes.

The format of the CloneImageAttributes method is:

      MagickBooleanType CloneImageAttributes(Image *image,
        const Image *clone_image)

A description of each parameter follows:

##### image

The image.

##### clone_image

The clone image.

## CloneMemory

CloneMemory() copies size bytes from memory area source to the destination. Copying between objects that overlap will take place correctly. It returns destination.

The format of the CloneMemory method is:

      void *CloneMemory(void *destination,const void *source,
        const size_t size)

A description of each parameter follows:

##### destination

The destination.

##### source

The source.

##### size

The size of the memory in bytes to allocate.

## ColorFloodfill

ColorFloodfill() changes the color value of any pixel that matches target and is an immediate neighbor. If the method FillToBorderMethod is specified, the color value is changed for any neighbor pixel that does not match the bordercolor member of image.

By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color for the purposes of the floodfill.

The format of the ColorFloodfillImage method is:

      MagickBooleanType ColorFloodfillImage(Image *image,
        const DrawInfo *draw_info,const PixelPacket target,
        const long x_offset,const long y_offset,const PaintMethod method)

A description of each parameter follows:

##### image

The image.

##### draw_info

The draw info.

##### target

The RGB value of the target color.

##### x,y

The starting location of the operation.

##### method

Choose either FloodfillMethod or FillToBorderMethod.

## DeleteImageAttribute

DeleteImageAttribute() deletes an attribute from the image.

The format of the DeleteImageAttribute method is:

      MagickBooleanType DeleteImageAttribute(Image *image,const char *key)

A description of each parameter follows:

##### image

The image info.

##### key

The image key.

## DeleteImageList

DeleteImageList() deletes an image at the specified position in the list.

The format of the DeleteImageList method is:

      unsigned int DeleteImageList(Image *images,const long offset)

A description of each parameter follows:

##### images

The image list.

##### offset

The position within the list.

## DescribeImage

DescribeImage() describes an image by printing its attributes to the file. Attributes include the image width, height, size, and others.

The format of the DescribeImage method is:

      MagickBooleanType DescribeImage(Image *image,FILE *file,
        const MagickBooleanType verbose)

A description of each parameter follows:

##### image

The image.

##### file

The file, typically stdout.

##### verbose

A value other than zero prints more detailed information about the image.

## DestroyImageAttributes

DestroyImageAttributes() deallocates memory associated with the image attribute list.

The format of the DestroyImageAttributes method is:

      DestroyImageAttributes(Image *image)

A description of each parameter follows:

##### image

The image.

## DestroyImages

DestroyImages() destroys an image list.

The format of the DestroyImages method is:

      void DestroyImages(Image *image)

A description of each parameter follows:

##### image

The image sequence.

## DestroyMagick

DestroyMagick() destroys the ImageMagick environment.

The format of the DestroyMagick function is:

      DestroyMagick(void)

## DispatchImage

DispatchImage() extracts pixel data from an image and returns it to you. The method returns MagickFalse on success otherwise MagickTrue 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:

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

The format of the DispatchImage method is:

      unsigned int DispatchImage(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, 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..QuantumRange]. 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.

## FormatImageAttribute

FormatImageAttribute() permits formatted key/value pairs to be saved as an image attribute.

The format of the FormatImageAttribute method is:

      MagickBooleanType FormatImageAttribute(Image *image,const char *key,
        const char *format,...)

A description of each parameter follows.

##### image

The image.

##### key

The attribute key.

##### format

A string describing the format to use to write the remaining arguments.

## FormatString

FormatString() prints formatted output of a variable argument list.

The format of the FormatString method is:

      void FormatString(char *string,const char *format,...)

A description of each parameter follows.

##### string

Method FormatString returns the formatted string in this character buffer.

##### format

A string describing the format to use to write the remaining arguments.

## GetConfigureBlob

GetConfigureBlob() returns the specified configure file as a blob.

The format of the GetConfigureBlob method is:

      void *GetConfigureBlob(const char *filename,ExceptionInfo *exception)

A description of each parameter follows:

##### filename

The configure file name.

##### path

return the full path information of the configure file.

##### length

This pointer to a size_t integer sets the initial length of the blob. On return, it reflects the actual length of the blob.

##### exception

Return any errors or warnings in this structure.

## GetImageAttribute

GetImageAttribute() searches the list of image attributes and returns a pointer to the attribute if it exists otherwise NULL.

The format of the GetImageAttribute method is:

      const ImageAttribute *GetImageAttribute(const Image *image,
        const char *key)

A description of each parameter follows:

##### image

The image.

##### key

These character strings are the name of an image attribute to return.

## GetImageClippingPathAttribute

GetImageClippingPathAttribute() searches the list of image attributes and returns a pointer to a clipping path if it exists otherwise NULL.

The format of the GetImageClippingPathAttribute method is:

      const ImageAttribute *GetImageClippingPathAttribute(Image *image)

A description of each parameter follows:

##### attribute

Method GetImageClippingPathAttribute returns the clipping path if it exists otherwise NULL.

##### image

The image.

## GetImageGeometry

GetImageGeometry() returns a region as defined by the geometry string with respect to the image and its gravity.

The format of the GetImageGeometry method is:

      int GetImageGeometry(Image *image,const char *geometry,
        const unsigned int size_to_fit,RectangeInfo *region_info)

A description of each parameter follows:

##### flags

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

##### geometry

The geometry (e.g. 100x100+10+10).

##### size_to_fit

A value other than 0 means to scale the region so it fits within the specified width and height.

##### region_info

The region as defined by the geometry string with respect to the image and its gravity.

## GetImageList

GetImageList() returns an image at the specified position in the list.

The format of the GetImageList method is:

      Image *GetImageList(const Image *images,const long offset,
        ExceptionInfo *exception)

A description of each parameter follows:

##### images

The image list.

##### offset

The position within the list.

##### exception

Return any errors or warnings in this structure.

## GetImageListIndex

GetImageListIndex() returns the position in the list of the specified image.

The format of the GetImageListIndex method is:

      long GetImageListIndex(const Image *images)

A description of each parameter follows:

##### images

The image list.

## GetImageListSize

GetImageListSize() returns the number of images in the list.

The format of the GetImageListSize method is:

      unsigned long GetImageListSize(const Image *images)

A description of each parameter follows:

##### images

The image list.

## GetNextImage

GetNextImage() returns the next image in a list.

The format of the GetNextImage method is:

      Image *GetNextImage(const Image *images)

A description of each parameter follows:

##### images

The image list.

## GetNextImageAttribute

GetNextImageAttribute() gets the next image attribute.

The format of the GetNextImageAttribute method is:

      const ImageAttribute *GetNextImageAttribute(const Image *image)

A description of each parameter follows:

##### image

The image.

## GetNumberScenes

GetNumberScenes() returns the number of images in the list.

The format of the GetNumberScenes method is:

      unsigned int GetNumberScenes(const Image *images)

A description of each parameter follows:

##### images

The image list.

## GetPreviousImage

GetPreviousImage() returns the previous image in a list.

The format of the GetPreviousImage method is:

      Image *GetPreviousImage(const Image *images)

A description of each parameter follows:

##### images

The image list.

## IdentityAffine

IdentityAffine() initializes the affine transform to the identity matrix.

The format of the IdentityAffine method is:

      IdentityAffine(AffineMatrix *affine)

A description of each parameter follows:

##### affine

A pointer the the affine transform of type AffineMatrix.

## InitializeMagick

InitializeMagick() initializes the ImageMagick environment.

The format of the InitializeMagick function is:

      InitializeMagick(const char *path)

A description of each parameter follows:

##### path

The execution path of the current ImageMagick client.

## InterpretImageAttributes

InterpretImageAttributes() replaces any embedded formatting characters with the appropriate image attribute and returns the translated text.

The format of the InterpretImageAttributes method is:

      char *InterpretImageAttributes(const ImageInfo *image_info,Image *image,
        const char *embed_text)

A description of each parameter follows:

##### image_info

The image info.

##### image

The image.

##### embed_text

The address of a character string containing the embedded formatting characters.

## LiberateMemory

LiberateMemory() frees memory that has already been allocated, and NULL's the pointer to it.

The format of the LiberateMemory method is:

      void LiberateMemory(void **memory)

A description of each parameter follows:

##### memory

A pointer to a block of memory to free for reuse.

## LiberateSemaphoreInfo

LiberateSemaphoreInfo() relinquishes a semaphore.

The format of the LiberateSemaphoreInfo method is:

      LiberateSemaphoreInfo(void **semaphore_info)

A description of each parameter follows:

##### semaphore_info

Specifies a pointer to an SemaphoreInfo structure.

## MagickIncarnate

MagickIncarnate() initializes the ImageMagick environment.

The format of the MagickIncarnate function is:

      MagickIncarnate(const char *path)

A description of each parameter follows:

##### path

The execution path of the current ImageMagick client.

## MagickMonitor

MagickMonitor() calls the monitor handler method with a text string that describes the task and a measure of completion. The method returns MagickTrue on success otherwise MagickFalse if an error is encountered, e.g. if there was a user interrupt.

The format of the MagickMonitor method is:

      MagickBooleanType MagickMonitor(const char *text,
        const MagickOffsetType offset,const MagickSizeType span,
        void *client_data)

A description of each parameter follows:

##### offset

The position relative to the span parameter which represents how much progress has been made toward completing a task.

##### span

The span relative to completing a task.

##### client_data

The client data.

## MatteFloodfill

MatteFloodfill() changes the transparency value of any pixel that matches target and is an immediate neighbor. If the method FillToBorderMethod is specified, the transparency value is changed for any neighbor pixel that does not match the bordercolor member of image.

By default target must match a particular pixel transparency exactly. However, in many cases two transparency values may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two transparency values as the same. For example, set fuzz to 10 and the opacity values of 100 and 102 respectively are now interpreted as the same value for the purposes of the floodfill.

The format of the MatteFloodfillImage method is:

      MagickBooleanType MatteFloodfillImage(Image *image,
        const PixelPacket target,const Quantum opacity,const long x_offset,
        const long y_offset,const PaintMethod method)

A description of each parameter follows:

##### image

The image.

##### target

The RGB value of the target color.

##### opacity

The level of transparency: 0 is fully opaque and QuantumRange is fully transparent.

##### x,y

The starting location of the operation.

##### method

Choose either FloodfillMethod or FillToBorderMethod.

## OpaqueImage

OpaqueImage() changes any pixel that matches color with the color defined by fill.

By default color must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. Fuzz defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.

The format of the OpaqueImage method is:

      MagickBooleanType OpaqueImage(Image *image,
        const PixelPacket *target,const PixelPacket fill)

A description of each parameter follows:

##### image

The image.

##### target

The RGB value of the target color.

##### fill

The replacement color.

## PopImageList

PopImageList() removes the last image in the list.

The format of the PopImageList method is:

      Image *PopImageList(Image **images)

A description of each parameter follows:

##### images

The image list.

## 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.

## PostscriptGeometry

PostscriptGeometry() replaces any page mneumonic with the equivalent size in picas.

The format of the PostscriptGeometry method is:

      char *PostscriptGeometry(const char *page)

A description of each parameter follows.

##### page

Specifies a pointer to an array of characters. The string is either a Postscript page name (e.g. A4) or a postscript page geometry (e.g. 612x792+36+36).

## PushImageList

PushImageList() adds an image to the end of the list.

The format of the PushImageList method is:

      unsigned int PushImageList(Image *images,const Image *image,
        ExceptionInfo *exception)

A description of each parameter follows:

##### images

The image list.

##### image

The image.

##### exception

Return any errors or warnings in this structure.

## 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.

## QuantizationError

QuantizationError() measures the difference between the original and quantized images. This difference is the total quantization error. The error is computed by summing over all pixels in an image the distance squared in RGB space between each reference pixel value and its quantized value. These values are computed:

          o mean_error_per_pixel:  This value is the mean error for any single
      pixel in the image.

##### normalized_mean_square_error

This value is the normalized mean quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in the image.

##### normalized_maximum_square_error

Thsi value is the normalized maximum quantization error for any single pixel in the image. This distance measure is normalized to a range between 0 and 1. It is independent of the range of red, green, and blue values in your image.

The format of the QuantizationError method is:

      unsigned int QuantizationError(Image *image)

A description of each parameter follows.

##### image

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

## RandomChannelThresholdImage

RandomChannelThresholdImage() changes the value of individual pixels based on the intensity of each pixel compared to a random threshold. The result is a low-contrast, two color image.

The format of the RandomChannelThresholdImage method is:

      unsigned int RandomChannelThresholdImage(Image *image,
         const char *channel, const char *thresholds,
         ExceptionInfo *exception)

A description of each parameter follows:

##### image

The image.

##### channel

The channel or channels to be thresholded.

##### thresholds

a geometry string containing LOWxHIGH thresholds. If the string contains 2x2, 3x3, or 4x4, then an ordered dither of order 2, 3, or 4 will be performed instead.

##### exception

Return any errors or warnings in this structure.

## ReacquireMemory

ReacquireMemory() changes the size of the memory and returns a pointer to the (possibly moved) block. The contents will be unchanged up to the lesser of the new and old sizes.

The format of the ReacquireMemory method is:

      void ReacquireMemory(void **memory,const size_t size)

A description of each parameter follows:

##### memory

A pointer to a memory allocation. On return the pointer may change but the contents of the original allocation will not.

##### size

The new size of the allocated memory.

## ResetImageAttributeIterator

ResetImageAttributeIterator() resets the image attributes iterator. Use it in conjunction with GetNextImageAttribute() to iterate over all the values associated with an image.

The format of the ResetImageAttributeIterator method is:

      ResetImageAttributeIterator(const ImageInfo *image)

A description of each parameter follows:

##### image

The image.

## SetExceptionInfo

SetExceptionInfo() sets the exception severity.

The format of the SetExceptionInfo method is:

      MagickBooleanType SetExceptionInfo(ExceptionInfo *exception,
        ExceptionType severity)

A description of each parameter follows:

##### exception

The exception info.

##### severity

The exception severity.

## SetImage

SetImage() sets the red, green, and blue components of each pixel to the image background color and the opacity component to the specified level of transparency. The background color is defined by the background_color member of the image.

The format of the SetImage method is:

      void SetImage(Image *image,const Quantum opacity)

A description of each parameter follows:

##### image

The image.

##### opacity

Set each pixel to this level of transparency.

## SetImageAttribute

SetImageAttribute() searches the list of image attributes and replaces the attribute value. If it is not found in the list, the attribute name and value is added to the list.

The format of the SetImageAttribute method is:

       MagickBooleanType SetImageAttribute(Image *image,const char *key,
         const char *value)

A description of each parameter follows:

##### image

The image.

##### key

The key.

##### value

The value.

## SetImageList

SetImageList() inserts an image into the list at the specified position.

The format of the SetImageList method is:

      unsigned int SetImageList(Image *images,const Image *image,
        const long offset,ExceptionInfo *exception)

A description of each parameter follows:

##### images

The image list.

##### image

The image.

##### offset

The position within the list.

##### exception

Return any errors or warnings in this structure.

## SetMonitorHandler

SetMonitorHandler() sets the monitor handler to the specified method and returns the previous monitor handler.

The format of the SetMonitorHandler method is:

      MonitorHandler SetMonitorHandler(MonitorHandler handler)

A description of each parameter follows:

##### handler

Specifies a pointer to a method to handle monitors.

## ShiftImageList

ShiftImageList() removes an image from the beginning of the list.

The format of the ShiftImageList method is:

      Image *ShiftImageList(Image **images)

A description of each parameter follows:

##### images

The image list.

## SpliceImageList

SpliceImageList() removes the images designated by offset and length from the list and replaces them with the specified list.

The format of the SpliceImageList method is:

      Image *SpliceImageList(Image *images,const long offset,
        const unsigned long length,const Image *splices,
        ExceptionInfo *exception)

A description of each parameter follows:

##### images

The image list.

##### offset

The position within the list.

##### length

The length of the image list to remove.

##### splice

Replace the removed image list with this list.

##### exception

Return any errors or warnings in this structure.

## Strip

Strip() strips any whitespace or quotes from the beginning and end of a string of characters.

The format of the Strip method is:

      void Strip(char *message)

A description of each parameter follows:

##### message

Specifies an array of characters.

## TemporaryFilename

TemporaryFilename() replaces the contents of path by a unique path name.

The format of the TemporaryFilename method is:

      void TemporaryFilename(char *path)

A description of each parameter follows.

##### path

Specifies a pointer to an array of characters. The unique path name is returned in this array.

## ThresholdImage

ThresholdImage() changes the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image.

The format of the ThresholdImage method is:

      unsigned int ThresholdImage(Image *image,const double threshold)

A description of each parameter follows:

##### image

The image.

##### threshold

Define the threshold value

## ThresholdImageChannel

ThresholdImageChannel() changes the value of individual pixels based on the intensity of each pixel channel. The result is a high-contrast image.

The format of the ThresholdImageChannel method is:

      unsigned int ThresholdImageChannel(Image *image,const char *threshold)

A description of each parameter follows:

##### image

The image.

##### threshold

define the threshold values.

## TranslateText

TranslateText() replaces any embedded formatting characters with the appropriate image attribute and returns the translated text.

The format of the TranslateText method is:

      char *TranslateText(const ImageInfo *image_info,Image *image,
        const char *embed_text)

A description of each parameter follows:

##### image_info

The image info.

##### image

The image.

##### embed_text

The address of a character string containing the embedded formatting characters.

## TransparentImage

TransparentImage() changes the opacity value associated with any pixel that matches color to the value defined by opacity.

By default color must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. Fuzz defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.

The format of the TransparentImage method is:

      MagickBooleanType TransparentImage(Image *image,
        const PixelPacket target,const Quantum opacity)

A description of each parameter follows:

##### image

The image.

##### target

The RGB value of the target color.

##### opacity

The replacement opacity value.

## UnshiftImageList

UnshiftImageList() adds the image to the beginning of the list.

The format of the UnshiftImageList method is:

      unsigned int UnshiftImageList(Image *images,const Image *image,
        ExceptionInfo *exception)

A description of each parameter follows:

##### images

The image list.

##### image

The image.

##### exception

Return any errors or warnings in this structure.

Discourse Server • Mailing Lists • ImageMagick Studio