ImageMagick: MagickCore, C API for ImageMagick: Image Methods
Author: ImageMagick Studio LLC
Description: ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (about 100) including GIF, JPEG, JPEG-2000, PNG, PDF, PhotoCD, TIFF, and DPX. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you can freely use, copy, modify, and distribute. Its license is compatible with the GPL. It runs on all major operating systems. The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite programming language. Choose from these interfaces: MagickCore (C), MagickWand (C), ChMagick (Ch), Magick++ (C++), JMagick (Java), L-Magick (Lisp), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (P [cell cut: 1167 characters, first 1000 kept]
Keywords: magickcore, c, api, for, imagemagick:, image, methods, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand

## AcquireImageInfo AcquireImageInfo() allocates the ImageInfo structure. The format of the AcquireImageInfo method is:
      ImageInfo *AcquireImageInfo(void)
## AllocateImage AllocateImage() returns a pointer to an image structure initialized to default values. The format of the AllocateImage method is:
      Image *AllocateImage(const ImageInfo *image_info)
A description of each parameter follows: ##### image_info Many of the image default values are set from this structure. For example, filename, compression, depth, background color, and others. ## AllocateImageColormap AllocateImageColormap() allocates an image colormap and initializes it to a linear gray colorspace. If the image already has a colormap, it is replaced. AllocateImageColormap() returns MagickTrue if successful, otherwise MagickFalse if there is not enough memory. The format of the AllocateImageColormap method is:
      MagickBooleanType AllocateImageColormap(Image *image,
        const unsigned long colors)
A description of each parameter follows: ##### image The image. ##### colors The number of colors in the image colormap. ## AllocateNextImage AllocateNextImage() initializes the next image in a sequence to default values. The next member of image points to the newly allocated image. If there is a memory shortage, next is assigned NULL. The format of the AllocateNextImage method is:
      void AllocateNextImage(const ImageInfo *image_info,Image *image)
A description of each parameter follows: ##### image_info Many of the image default values are set from this structure. For example, filename, compression, depth, background color, and others. ##### image The image. ## AppendImages AppendImages() takes all images from the current image pointer to the end of the image list and and appends them to each other top-to-bottom if the stack parameter is true, otherwise left-to-right. The format of the AppendImage method is:
      Image *AppendImages(const Image *image,const MagickBooleanType stack,
        ExceptionInfo *exception)
A description of each parameter follows: ##### image The image sequence. ##### stack A value other than 0 stacks the images top-to-bottom. ##### exception Return any errors or warnings in this structure. ## AverageImages AverageImages() takes a set of images and averages them together. Each image in the set must have the same width and height. AverageImages() returns a single image with each corresponding pixel component of each image averaged. On failure, a NULL image is returned and exception describes the reason for the failure. The format of the AverageImages method is:
      Image *AverageImages(Image *image,ExceptionInfo *exception)
A description of each parameter follows: ##### image The image sequence. ##### exception Return any errors or warnings in this structure. ## CatchImageException CatchImageException() returns if no exceptions are found in the image sequence, otherwise it determines the most severe exception and reports it as a warning or error depending on the severity. The format of the CatchImageException method is:
      ExceptionType CatchImageException(Image *image)
A description of each parameter follows: ##### image An image sequence. ## ClipImagePath ClipImagePath() sets the image clip mask based any clipping path information if it exists. The format of the ClipImagePath method is:
      MagickBooleanType ClipImagePath(Image *image,const char *pathname,
        const MagickBooleanType inside)
A description of each parameter follows: ##### image The image. ##### pathname name of clipping path resource. If name is preceded by #, use clipping path numbered by name. ##### inside if non-zero, later operations take effect inside clipping path. Otherwise later operations take effect outside clipping path. ## CloneImage CloneImage() copies an image and returns the copy as a new image object. If the specified columns and rows is 0, an exact copy of the image is returned, otherwise the pixel data is undefined and must be initialized with the SetImagePixels() and SyncImagePixels() methods. On failure, a NULL image is returned and exception describes the reason for the failure. The format of the CloneImage method is:
      Image *CloneImage(const Image *image,const unsigned long columns,
        const unsigned long rows,const MagickBooleanType orphan,
        ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ##### columns The number of columns in the cloned image. ##### rows The number of rows in the cloned image. ##### orphan With a value other than 0, the cloned image is an orphan. An orphan is a stand-alone image that is not assocated with an image list. In effect, the next and previous members of the cloned image is set to NULL. ##### exception Return any errors or warnings in this structure. ## CloneImageInfo CloneImageInfo() makes a copy of the given image info structure. If NULL is specified, a new image info structure is created initialized to default values. The format of the CloneImageInfo method is:
      ImageInfo *CloneImageInfo(const ImageInfo *image_info)
A description of each parameter follows: ##### image_info The image info. ## CombineImages CombineImages() combines one or more images into a single image. The grayscale value of the pixels of each image in the sequence is assigned in order to the specified channels of the combined image. The typical ordering would be image 1 => Red, 2 => Green, 3 => Blue, etc. The format of the CombineImages method is:
      Image *CombineImages(const Image *image,const ChannelType channel,
        ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ##### exception Return any errors or warnings in this structure. ## CycleColormap CycleColormap() displaces an image's colormap by a given number of positions. If you cycle the colormap a number of times you can produce a psychodelic effect. The format of the CycleColormapImage method is:
      MagickBooleanType CycleColormapImage(Image *image,const long displace)
A description of each parameter follows: ##### image The image. ##### displace displace the colormap this amount. ## DestroyImage DestroyImage() dereferences an image, deallocating memory associated with the image if the reference count becomes zero. The format of the DestroyImage method is:
      Image *DestroyImage(Image *image)
A description of each parameter follows: ##### image The image. ## DestroyImageInfo DestroyImageInfo() deallocates memory associated with an ImageInfo structure. The format of the DestroyImageInfo method is:
      ImageInfo *DestroyImageInfo(ImageInfo *image_info)
A description of each parameter follows: ##### image_info The image info. ## GetImageClipMask GetImageClipMask() returns the clip path associated with the image. The format of the GetImageClipMask method is:
      Image *GetImageClipMask(const Image *image,ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ## GetImageException GetImageException() traverses an image sequence and returns any error more severe than noted by the exception parameter. The format of the GetImageException method is:
      void GetImageException(Image *image,ExceptionInfo *exception)
A description of each parameter follows: ##### image Specifies a pointer to a list of one or more images. ##### exception return the highest severity exception. ## GetImageInfo GetImageInfo() initializes image_info to default values. The format of the GetImageInfo method is:
      void GetImageInfo(ImageInfo *image_info)
A description of each parameter follows: ##### image_info The image info. ## GetImageMask GetImageMask() returns the mask associated with the image. The format of the GetImageMask method is:
      Image *GetImageMask(const Image *image,ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ## GetImageType GetImageType() returns the potential type of image: Bilevel Grayscale GrayscaleMatte Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationMatte To ensure the image type matches its potential, use SetImageType():
          (void) SetImageType(image,GetImageType(image));
The format of the GetImageType method is:
      ImageType GetImageType(const Image *image,ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ##### exception Return any errors or warnings in this structure. ## GetImageVirtualPixelMethod GetImageVirtualPixelMethod() gets the "virtual pixels" method for the image. A virtual pixel is any pixel access that is outside the boundaries of the image cache. The format of the GetImageVirtualPixelMethod() method is:
      VirtualPixelMethod GetImageVirtualPixelMethod(const Image *image)
A description of each parameter follows: ##### image The image. ## InterpretImageFilename InterpretImageFilename() interprets embedded characters in an image filename. Only a single embedded sequence is replaced and the string length is returned. The format of the InterpretImageFilename method is:
      long InterpretImageFilename(char *string,const size_t length,
        const char *format,int value)
A description of each parameter follows. ##### string InterpretImageFilename() returns the formatted string in this character buffer. ##### length The maximum length of the string. ##### format A string describing the format to use to write the numeric argument. Only the first numeric format identifier is replaced. ##### value Numeric value to substitute into format string. ## IsHighDynamicRangeImage IsHighDynamicRangeImage() returns MagickFalse if any pixel component is non-integer or exceeds the bounds of the quantum depth (e.g. for Q16 0..65535. The format of the IsHighDynamicRangeImage method is:
      MagickBooleanType IsHighDynamicRangeImage(const Image *image,
        ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ##### exception Return any errors or warnings in this structure. ## IsImageObject IsImageObject() returns MagickTrue if the image sequence contains a valid set of image objects. The format of the IsImageObject method is:
      MagickBooleanType IsImageObject(const Image *image)
A description of each parameter follows: ##### image The image. ## IsTaintImage IsTaintImage() returns MagickTrue any pixel in the image has been altered since it was first constituted. The format of the IsTaintImage method is:
      MagickBooleanType IsTaintImage(const Image *image)
A description of each parameter follows: ##### image The image. ## ModifyImage ModifyImage() ensures that there is only a single reference to the image to be modified, updating the provided image pointer to point to a clone of the original image if necessary. The format of the ModifyImage method is:
      MagickBooleanType ModifyImage(Image *image,ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ##### exception Return any errors or warnings in this structure. ## NewMagickImage NewMagickImage() creates a blank image canvas of the specified size and background color. The format of the NewMagickImage method is:
      Image *NewMagickImage(const ImageInfo *image_info,
        const unsigned long width,const unsigned long height,
        const MagickPixelPacket *background)
A description of each parameter follows: ##### image The image. ##### width The image width. ##### height The image height. ##### background The image color. ## PlasmaImage PlasmaImage() initializes an image with plasma fractal values. The image must be initialized with a base color and the random number generator seeded before this method is called. The format of the PlasmaImage method is:
      MagickBooleanType PlasmaImage(Image *image,const SegmentInfo *segment,
        unsigned long attenuate,unsigned long depth)
A description of each parameter follows: ##### image The image. ##### segment Define the region to apply plasma fractals values. ##### attenuate Define the plasma attenuation factor. ##### depth Limit the plasma recursion depth. ## ReferenceImage ReferenceImage() increments the reference count associated with an image returning a pointer to the image. The format of the ReferenceImage method is:
      Image *ReferenceImage(Image *image)
A description of each parameter follows: ##### image The image. ## ResetImagePage ResetImagePage() resets the image page canvas and position. The format of the ResetImagePage method is:
      MagickBooleanType ResetImagePage(Image *image,const char *page)
A description of each parameter follows: ##### image The image. ##### page The relative page specification. ## SeparateImageChannel SeparateImageChannel() separates a channel from the image and returns it as a grayscale image. A channel is a particular color component of each pixel in the image. The format of the SeparateImageChannel method is:
      MagickBooleanType SeparateImageChannel(Image *image,
        const ChannelType channel)
A description of each parameter follows: ##### image The image. ##### channel Identify which channel to extract: RedChannel, GreenChannel, BlueChannel, OpacityChannel, CyanChannel, MagentaChannel, YellowChannel, or BlackChannel. ## SeparateImages SeparateImages() returns a separate grayscale image for each channel specified. The format of the SeparateImages method is:
      MagickBooleanType SeparateImages(const Image *image,
        const ChannelType channel,ExceptionInfo *exception)
A description of each parameter follows: ##### image The image. ##### channel Identify which channels to extract: RedChannel, GreenChannel, BlueChannel, OpacityChannel, CyanChannel, MagentaChannel, YellowChannel, or BlackChannel. ##### exception Return any errors or warnings in this structure. ## SetImageAlphaChannel SetImageAlphaChannel() activates, deactivates, resets, or sets the alpha channel. The format of the SetImageAlphaChannel method is:
      MagickBooleanType SetImageAlphaChannel(Image *image,
        const AlphaChannelType alpha_type)
A description of each parameter follows: ##### image The image. ##### alpha_type The alpha channel type: ActivateAlphaChannel, DeactivateAlphaChannel, ResetAlphaChannel, or SetAlphaChannel. ## SetImageBackgroundColor SetImageBackgroundColor() initializes the image pixels to the image background color. The background color is defined by the background_color member of the image structure. The format of the SetImage method is:
      MagickBooleanType SetImageBackgroundColor(Image *image)
A description of each parameter follows: ##### image The image. ## SetImageStorageClass SetImageStorageClass() sets the image class: DirectClass for true color images or PseudoClass for colormapped images. The format of the SetImageStorageClass method is:
      MagickBooleanType SetImageStorageClass(Image *image,
        const ClassType storage_class)
A description of each parameter follows: ##### image The image. ##### storage_class The image class. ## SetImageClipMask SetImageClipMask() associates a clip path with the image. The clip path must be the same dimensions as the image. Set any pixel component of the clip path to TransparentOpacity to prevent that corresponding image pixel component from being updated when SyncImagePixels() is applied. The format of the SetImageClipMask method is:
      MagickBooleanType SetImageClipMask(Image *image,const Image *clip_mask)
A description of each parameter follows: ##### image The image. ##### clip_mask The image clip path. ## SetImageExtent SetImageExtent() sets the image size (i.e. columns & rows). The format of the SetImageExtent method is:
      MagickBooleanType SetImageExtent(Image *image,
        const unsigned long columns,const unsigned long rows)
A description of each parameter follows: ##### image The image. ##### columns The image width in pixels. ##### rows The image height in pixels. ## SetImageInfoBlob SetImageInfoBlob() sets the image info blob member. The format of the SetImageInfoBlob method is:
      void SetImageInfoBlob(ImageInfo *image_info,const void *blob,
        const size_t length)
A description of each parameter follows: ##### image_info The image info. ##### blob The blob. ##### length The blob length. ## SetImageInfoFile SetImageInfoFile() sets the image info file member. The format of the SetImageInfoFile method is:
      void SetImageInfoFile(ImageInfo *image_info,FILE *file)
A description of each parameter follows: ##### image_info The image info. ##### file The file. ## SetImageMask SetImageMask() associates a mask with the image. The mask must be the same dimensions as the image. The format of the SetImageMask method is:
      MagickBooleanType SetImageMask(Image *image,const Image *mask)
A description of each parameter follows: ##### image The image. ##### mask The image mask. ## SetImageOpacity SetImageOpacity() sets the opacity levels of the image. The format of the SetImageOpacity method is:
      MagickBooleanType SetImageOpacity(Image *image,const Quantum opacity)
A description of each parameter follows: ##### image The image. ##### opacity The level of transparency: 0 is fully opaque and QuantumRange is fully transparent. ## SetImageType SetImageType() sets the type of image. Choose from these types: Bilevel Grayscale GrayscaleMatte Palette PaletteMatte TrueColor TrueColorMatte ColorSeparation ColorSeparationMatte OptimizeType The format of the SetImageType method is:
      MagickBooleanType SetImageType(Image *image,const ImageType image_type)
A description of each parameter follows: ##### image The image. ##### image_type Image type. ## SetImageVirtualPixelMethod SetImageVirtualPixelMethod() sets the "virtual pixels" method for the image and returns the previous setting. A virtual pixel is any pixel access that is outside the boundaries of the image cache. The format of the SetImageVirtualPixelMethod() method is:
      VirtualPixelMethod SetImageVirtualPixelMethod(const Image *image,
        const VirtualPixelMethod virtual_pixel_method)
A description of each parameter follows: ##### image The image. ##### virtual_pixel_method choose the type of virtual pixel. ## StripImage StripImage() strips an image of all profiles and comments. The format of the StripImage method is:
      MagickBooleanType StripImage(Image *image)
A description of each parameter follows: ##### image The image. ## TextureImage TextureImage() repeatedly tiles the texture image across and down the image canvas. The format of the TextureImage method is:
      MagickBooleanType TextureImage(Image *image,const Image *texture)
A description of each parameter follows: ##### image The image. ##### texture This image is the texture to layer on the background. |

Discourse Server • Mailing Lists • ImageMagick Studio