GraphicsMagick

- Home
- Project
- Download
- Install
- Source
- News
- Utilities
- Programming
- Reference

# color

Color related functions

Contents

- GetColorHistogram

- GetNumberColors

- IsPaletteImage

# GetColorHistogram

## Synopsis

    HistogramColorPacket *GetColorHistogram( const Image *, unsigned long *colors,
                                             ExceptionInfo *);

## Description

Method GetColorHistogram returns an array of HistogramColorPacket structures which specify the number of times each unique color occurs in the image. The referenced colors parameter is updated with the number of unique colors in the image. The returned array should be deallocated by the user once it is no longer needed.

The format of the GetColorHistogram method is:

    HistogramColorPacket *GetColorHistogram( const Image *, unsigned long *colors,
                                             ExceptionInfo *);

image:

  The image.

colors:

  The referenced value is updated with the with the number of unique colors.

exception:

  Return any errors or warnings in this structure.

# GetNumberColors

## Synopsis

    unsigned long GetNumberColors( const Image *image, FILE *file,
                                   ExceptionInfo *exception );

## Description

Method GetNumberColors returns the number of unique colors in an image.

The format of the GetNumberColors method is:

    unsigned long GetNumberColors( const Image *image, FILE *file,
                                   ExceptionInfo *exception );

image:

  The image.

file:

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

exception:

  Return any errors or warnings in this structure.

# IsPaletteImage

## Synopsis

    MagickBool IsPaletteImage( const Image *image, ExceptionInfo *exception );

## Description

Method IsPaletteImage returns True if the image is PseudoClass and has 256 unique colors or less.

The format of the IsPaletteImage method is:

    MagickBool IsPaletteImage( const Image *image, ExceptionInfo *exception );

A description of each parameter follows.

status:

  Method IsPaletteImage returns True is the image is PseudoClass or has 256 color or less.

image:

  The image.

exception:

  Return any errors or warnings in this structure.

Copyright © GraphicsMagick Group 2002 - 2024