GraphicsMagick Search site

- Home
- License
- Mission
- Download
- Installation
- FAQ
- News
- Formats

- Process
- Contribute
- CVS
- Mailing Lists
- ChangeLog
- Report Bugs
- Utilities
- Programming
- Links

# color

## Color related functions

Contents

- GetColorInfoArray
- GetColorHistogram
- GetColorList
- GetNumberColors
- IsGrayImage
- IsMonochromeImage
- IsOpaqueImage
- IsPaletteImage
- ListColorInfo
- QueryColorDatabase
- QueryColorname

# GetColorInfoArray

## Synopsis

    ColorInfo ** GetColorInfoArray( ExceptionInfo *exception );

## Description

GetColorInfoArray() returns a sorted null-terminated array of ColorInfo pointers corresponding to the available color definitions. This function should be used to access the entire list rather than GetColorInfo since the list returned by GetColorInfo may be re-ordered every time it is invoked. GetColorList may be used if only a list of color names is desired. The array should be deallocated by the user once it is no longer needed. Do not attempt to deallocate members of the array.

The format of the GetMagickList method is:

    ColorInfo ** GetColorInfoArray( ExceptionInfo *exception );

A description of each parameter follows:

exception:
  Return any errors or warnings in this structure.

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

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.

# GetColorList

## Synopsis

    filelist=GetColorList( const char *pattern, unsigned long *number_colors );

## Description

Method GetColorList returns any colors that match the specified pattern and color standard.

The format of the GetColorList function is:

    filelist=GetColorList( const char *pattern, unsigned long *number_colors );

A description of each parameter follows:

filelist:
  Method GetColorList returns a list of colors that match the specified pattern and color standard.
pattern:
  Specifies a pointer to a text string containing a pattern.
number_colors:
  This integer returns the number of colors in the list.

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

# IsGrayImage

## Synopsis

    unsigned int IsGrayImage( const Image *image, ExceptionInfo *exception );

## Description

IsGrayImage() returns True if all the pixels in the image have the same red, green, and blue intensities.

The format of the IsGrayImage method is:

    unsigned int IsGrayImage( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

status:
  Method IsGrayImage returns True if the image is grayscale otherwise False is returned.
image:
  The image.
exception:
  Return any errors or warnings in this structure.

# IsMonochromeImage

## Synopsis

    unsigned int IsMonochromeImage( const Image *image, ExceptionInfo *exception );

## Description

IsMonochromeImage() returns True if all the pixels in the image have the same red, green, and blue intensities and the intensity is either 0 or MaxRGB.

The format of the IsMonochromeImage method is:

    unsigned int IsMonochromeImage( const Image *image, ExceptionInfo *exception );

image:
  The image.
exception:
  Return any errors or warnings in this structure.

# IsOpaqueImage

## Synopsis

    unsigned int IsOpaqueImage( const Image *image, ExceptionInfo *exception );

## Description

IsOpaqueImage() returns True if none of the pixels in the image have an opacity value other than opaque (0).

The format of the IsOpaqueImage method is:

    unsigned int IsOpaqueImage( const Image *image, ExceptionInfo *exception );

A description of each parameter follows:

status:
  Method IsOpaqueImage returns False if the image has one or more pixels that are transparent otherwise True is returned.
image:
  The image.
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.

# ListColorInfo

## Synopsis

    unsigned int ListColorInfo( FILE *file, ExceptionInfo *exception );

## Description

ListColorInfo() lists color names to the specified file. Color names are a convenience. Rather than defining a color by its red, green, and blue intensities just use a color name such as white, blue, or yellow.

The format of the ListColorInfo method is:

    unsigned int ListColorInfo( FILE *file, ExceptionInfo *exception );

A description of each parameter follows.

file:
  List color names to this file handle.
exception:
  Return any errors or warnings in this structure.

# QueryColorDatabase

## Synopsis

    unsigned int QueryColorDatabase( const char *name, PixelPacket *color,
                                     ExceptionInfo *exception );

## Description

QueryColorDatabase() returns the red, green, blue, and opacity intensities for a given color name.

The format of the QueryColorDatabase method is:

    unsigned int QueryColorDatabase( const char *name, PixelPacket *color,
                                     ExceptionInfo *exception );

name:
  The color name (e.g. white, blue, yellow).
color:
  The red, green, blue, and opacity intensities values of the named color in this structure.
exception:
  Return any errors or warnings in this structure.

# QueryColorname

## Synopsis

    unsigned int QueryColorname( const Image *image, const PixelPacket *color,
                                 const ComplianceType compliance, char *name,
                                 ExceptionInfo *exception );

## Description

QueryColorname() returns a named color for the given color intensity. If an exact match is not found, a hex value is return instead. For example an intensity of rgb:(0,0,0) returns black whereas rgb:(223,223,223) returns #dfdfdf.

The format of the QueryColorname method is:

    unsigned int QueryColorname( const Image *image, const PixelPacket *color,
                                 const ComplianceType compliance, char *name,
                                 ExceptionInfo *exception );

image:
  The image.
color:
  The color intensities.
Compliance:
  Adhere to this color standard: NoCompliance, SVGCompliance, X11Compliance, XPMCompliance, AllCompliance.
name:
  Return the color name or hex value.
exception:
  Return any errors or warnings in this structure.