# ImageMagick: MagickCore, C API for ImageMagick: Compare an Image to a Reconstructed Image
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 [cut: 1167 characters, first 599 kept]
Author: ImageMagick Studio LLC
Keywords: magickcore, c, api, for, imagemagick:, compare, an, image, to, a, reconstructed, image, ImageMagick, ImageMagic, MagickCore, MagickWand, PerlMagick, Magick++, RMagick, PythonMagick, JMagick, TclMagick, Image, Magick, Magic, Wand

## CompareImageChannels

CompareImageChannels() compares one or more image channels of an image to a reconstructed image and returns the difference image.

The format of the CompareImageChannels method is:

      Image *CompareImageChannels(const Image *image,
        const Image *reconstruct_image,const ChannelType channel,
        const MetricType metric,double *distortion,ExceptionInfo *exception)

A description of each parameter follows:

##### image

The image.

##### reconstruct_image

The reconstruct image.

##### channel

The channel.

##### metric

The metric.

##### distortion

The computed distortion between the images.

##### exception

Return any errors or warnings in this structure.

## GetImageChannelDistrortion

GetImageChannelDistrortion() compares one or more image channels of an image to a reconstructed image and returns the specified distortion metric.

The format of the CompareImageChannels method is:

      MagickBooleanType GetImageChhannelDistortion(const Image *image,
        const Image *reconstruct_image,const ChannelType channel,
        const MetricType metric,double *distortion,ExceptionInfo *exception)

A description of each parameter follows:

##### image

The image.

##### reconstruct_image

The reconstruct image.

##### channel

The channel.

##### metric

The metric.

##### distortion

The computed distortion between the images.

##### exception

Return any errors or warnings in this structure.

## IsImagesEqual

IsImagesEqual() measures the difference between colors at each pixel location of two images. A value other than 0 means the colors match exactly. Otherwise an error measure is computed by summing over all pixels in an image the distance squared in RGB space between each image pixel and its corresponding pixel in the reconstruct image. The error measure is assigned to these image members:

          o mean_error_per_pixel:  The mean error for any single pixel in
      the image.

##### normalized_mean_error

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_error

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.

A small normalized mean square error, accessed as image->normalized_mean_error, suggests the images are very similar in spatial layout and color.

The format of the IsImagesEqual method is:

      MagickBooleanType IsImagesEqual(Image *image,
        const Image *reconstruct_image)

A description of each parameter follows.

##### image

The image.

##### reconstruct_image

The reconstruct image.

Discourse Server • Mailing Lists • ImageMagick Studio