NAME

colors - Methods to Count the Colors in an Image


SYNOPSIS

filelist= GetColorlist( const char *pattern, int number_colors );

number_colors= GetNumberColors( image, file );

unsigned int IsGrayImage( Image *image );

status= IsMonochromeImage( image );

unsigned int IsOpaqueImage( Image *image );

unsigned int IsPseudoClass( Image *image );

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

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


FUNCTION DESCRIPTIONS

GetColorlist

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, int 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

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

The format of the GetNumberColors method is:

number_colors=GetNumberColors ( image, file );

A description of each parameter follows.

number_colors:
Method GetNumberColors returns the number of unique colors in the specified image.

image:
The address of a byte (8 bits) array of run-length encoded pixel data of your source image. The sum of the run-length counts in the source image must be equal to or exceed the number of pixels.

file:
An pointer to a FILE. If it is non-null a list of unique pixel field values and the number of times each occurs in the image is written to the file.

IsGrayImage

Method IsGrayImage returns True if the image is grayscale otherwise False is returned. If the image is DirectClass and grayscale, it is demoted to PseudoClass.

The format of the IsGrayImage method is:

unsigned int IsGrayImage ( Image *image );

A description of each parameter follows:

status:
Method IsGrayImage returns True if the image is grayscale otherwise False is returned.

image:
The address of a structure of type Image; returned from ReadImage.

IsMonochromeImage

Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned. If the image is DirectClass and grayscale (including monochrome), it is demoted to PseudoClass.

The format of the IsMonochromeImage method is:

status=IsMonochromeImage ( image );

A description of each parameter follows:

status:
Method IsMonochromeImage returns True if the image is monochrome otherwise False is returned.

image:
The address of a structure of type Image; returned from ReadImage.

IsOpaqueImage

Method IsOpaqueImage returns False if the image has one or more pixels that are transparent otherwise True is returned.

The format of the IsOpaqueImage method is:

unsigned int IsOpaqueImage ( Image *image );

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 address of a structure of type Image; returned from ReadImage.

IsPseudoClass

Method IsPseudoClass returns True if the image is PseudoClass and has 256 unique colors or less. If the image is DirectClass and has 256 colors or less, the image is demoted to PseudoClass.

The format of the IsPseudoClass method is:

unsigned int IsPseudoClass ( Image *image );

A description of each parameter follows.

status:
Method IsPseudoClass returns True is the image is PseudoClass or has 256 color or less.

image:
The address of a structure of type Image.

ListColorInfo

Method ListColorInfo lists the color info to a file.

The format of the ListColorInfo method is:

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

A description of each parameter follows.

file:
An pointer to a FILE.

exception:
return any errors or warnings in this structure.

QueryColorDatabase

Method QueryColorDatabase looks up a RGB values for a given color name.

The format of the QueryColorDatabase method is:

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

A description of each parameter follows:

status:
Method QueryColorDatabase returns True if the RGB values of the target color is defined, otherwise False is returned.

name:
Specifies the color to lookup in the X color database.

color:
A pointer to an PixelPacket structure. The RGB value of the target color is returned as this value.

QueryColorName

Method QueryColorName returns the name of the color that is closest to the supplied color in RGB space.

The format of the QueryColorName method is:

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

A description of each parameter follows.

distance:
Method QueryColorName returns the distance-squared in RGB space as well as the color name that is at a minimum distance.

image:
The address of a structure of type Image.

color:
This is a pointer to a PixelPacket structure that contains the color we are searching for.

name:
The name of the color that is closest to the supplied color is returned in this character buffer.