Unix
Mac OS X
iOS
Windows
Processing
Options
Usage
MagickWand
MagickCore
PerlMagick
Magick++
Unix
Windows
Links

# Module histogram Methods

## GetImageHistogram

GetImageHistogram() returns the unique colors in an image.

The format of the GetImageHistogram method is:

      size_t GetImageHistogram(const Image *image,
        size_t *number_colors,ExceptionInfo *exception)

A description of each parameter follows.

##### image

the image.

##### file

Write a histogram of the color distribution to this file handle.

##### exception

return any errors or warnings in this structure.

## IsHistogramImage

IsHistogramImage() returns MagickTrue if the image has 1024 unique colors or less.

The format of the IsHistogramImage method is:

      MagickBooleanType IsHistogramImage(const Image *image,
        ExceptionInfo *exception)

A description of each parameter follows.

##### image

the image.

##### exception

return any errors or warnings in this structure.

## IsPaletteImage

IsPaletteImage() returns MagickTrue if the image is PseudoClass and has 256 unique colors or less.

The format of the IsPaletteImage method is:

      MagickBooleanType IsPaletteImage(const Image *image,
        ExceptionInfo *exception)

A description of each parameter follows.

##### image

the image.

##### exception

return any errors or warnings in this structure.

## MinMaxStretchImage

MinMaxStretchImage() uses the exact minimum and maximum values found in each of the channels given, as the BlackPoint and WhitePoint to linearly stretch the colors (and histogram) of the image. The stretch points are also moved further inward by the adjustment values given.

If the adjustment values are both zero this function is equivalent to a perfect normalization (or autolevel) of the image.

Each channel is stretched independantally of each other (producing color distortion) unless the special 'SyncChannels' flag is also provided in the channels setting. If this flag is present the minimum and maximum point will be extracted from all the given channels, and those channels will be stretched by exactly the same amount (preventing color distortion).

In the special case that only ONE value is found in a channel of the image that value is not stretched, that value is left as is.

The 'SyncChannels' is turned on in the 'DefaultChannels' setting by default.

The format of the MinMaxStretchImage method is:

      MagickBooleanType MinMaxStretchImage(Image *image,
        const ChannelType channel, const double black_adjust,
        const double white_adjust)

A description of each parameter follows:

##### image

The image to auto-level

##### channel

The channels to auto-level. If the special 'SyncChannels' flag is set, all the given channels are stretched by the same amount.

##### black_adjust, white_adjust

Move the Black/White Point inward from the minimum and maximum points by this color value.

## GetNumberColors

GetNumberColors() returns the number of unique colors in an image.

The format of the GetNumberColors method is:

      size_t GetNumberColors(const Image *image,FILE *file,
        ExceptionInfo *exception)

A description of each parameter follows.

##### image

the image.

##### file

Write a histogram of the color distribution to this file handle.

##### exception

return any errors or warnings in this structure.

## UniqueImageColors

UniqueImageColors() returns the unique colors of an image.

The format of the UniqueImageColors method is:

      Image *UniqueImageColors(const Image *image,ExceptionInfo *exception)

A description of each parameter follows.

##### image

the image.

##### exception

return any errors or warnings in this structure.

Discourse Server • Studio