?colors - Methods to Count the Colors in an Image>/


NAME



0colors - Methods to Count the Colors in an Image






(

SYNOPSIS



Evoid CompressColormap( Image *image );



?number_colors= GetNumberColors( image, file );



Hunsigned int IsGrayImage( Image *image );



4status= IsMonochromeImage( image );



Junsigned int IsPseudoClass( Image *image );



iunsigned int QueryColorDatabase( const char *target, PixelPacket *color );



cunsigned int QueryColorName( const PixelPacket *color, char *name );






B

FUNCTION DESCRIPTIONS






8

CompressColormap



KMethod CompressColormap compresses an image colormap removing any duplicateand unused color entries.



-The format of the CompressColormap method is:

`
void CompressColormap ( Image *image );


=A description of each parameter follows:


7

image:


)The address of a structure of type Image.






6

GetNumberColors



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



,The format of the GetNumberColors method is:

H
number_colors=GetNumberColors ( image, file );


=A description of each parameter follows.


*

number_colors:


KMethod GetNumberColors returns the number of unique colors in the specifiedimage.

"

image:


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

!

file:


An pointer to a IFILE. If it is non-null a list of unique pixel fieldIvalues and the number of times each occurs in the image is written to thefile.



=A description of each parameter follows.


'

color_cube:


9A pointer to the CubeInfo structure.

"

level:


;Specifies the level in the classification the node resides.






.

IsGrayImage



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



(The format of the IsGrayImage method is:

c
unsigned int IsGrayImage ( Image *image );


=A description of each parameter follows:


#

status:


IMethod IsGrayImage returns True if the image is grayscale otherwise False is returned.

"

image:


BThe address of a structure of type Image; returned from ReadImage.






:

IsMonochromeImage



JMethod IsMonochromeImage returns True if the image is monochrome otherwiseDFalse is returned. If the image is DirectClass and monochrome, it isdemoted to PseudoClass.



.The format of the IsMonochromeImage method is:

=
status=IsMonochromeImage ( image );


=A description of each parameter follows:


#

status:


JMethod IsMonochromeImage returns True if the image is monochrome otherwiseFalse is returned.

"

image:


BThe address of a structure of type Image; returned from ReadImage.






2

IsPseudoClass



IMethod IsPseudoClass returns True if the image is PseudoClass and has 256Hunique 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:

e
unsigned int IsPseudoClass ( Image *image );


=A description of each parameter follows.


#

status:


HMethod IsPseudoClass returns True is the image is PseudoClass or has 256color or less.

"

image:


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






<

QueryColorDatabase



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



/The format of the QueryColorDatabase method is:

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


=A description of each parameter follows:


#

status:


.Method QueryColorDatabase returns True if the IRGB values of the target color is defined, otherwiseFalse is returned.

#

target:


%Specifies the color to lookup in the &X color database.

"

color:


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






4

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 ( const PixelPacket *color, char *name );


=A description of each parameter follows.


%

distance:


6Method QueryColorName returns the distance-squared in ERGB space as well as the color name that is at aminimum distance.

"

color:


KThis is a pointer to a PixelPacket structure that contains the color we aresearching for.

!

name:


JThe name of the color that is closest to the supplied color is returned inthis character buffer.