NAME

colors - Methods to Count the Colors in an Image


SYNOPSIS

CompressColormap(image)

number_colors=GetNumberColors(image,file)

status=IsMonochromeImage(image)

status=IsPseudoClass(image)

status=QueryColorDatabase(target,color)

distance=QueryColorName(color,name)


FUNCTION DESCRIPTIONS


CompressColormap

Method CompressColormap compresses an image colormap removing any duplicate and unused color entries.

The format of the CompressColormap routine is:

        CompressColormap(image)

A description of each parameter follows:

image:

The address of a structure of type Image.

A description of each parameter follows.

node_info:

The address of a structure of type NodeInfo which points to a node in the color cube tree that is to be pruned.


GetNumberColors

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

The format of the GetNumberColors routine 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.

A description of each parameter follows.

color_cube:

A pointer to the CubeInfo structure.

level:

Specifies the level in the classification the node resides.


IsMonochromeImage

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

The format of the IsMonochromeImage routine 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.


IsPseudoClass

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

The format of the IsPseudoClass routine is:

        status=IsPseudoClass(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 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.


QueryColorDatabase

Method QueryColorDatabase looks up a RGB values for a color given in the target string.

The format of the QueryColorDatabase routine is:

      status=QueryColorDatabase(target,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.

target:

Specifies the color to lookup in the X color database.

color:

A pointer to an ColorPacket 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 routine is:

        distance=QueryColorName(color,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.

color:

This is a pointer to a ColorPacket 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.