Re: Detecting a greyscale image

Bob Friesenhahn <[email protected]> Tue, 13 Jan 2009 11:17:58 -0600 (CST)
Newsgroups gmane.comp.video.graphicsmagick.core
Message-ID <[email protected]>
On Tue, 13 Jan 2009, Nguyen Vu Hung wrote:

> Hi all,
> Suppose that I have an RGB( or ARGB) imageand I have to detect that if it is a "true" color imageor a grayscale image.
> By "detect", I mean that I have to look at the image's RGB values,not by naked eyes.
> Fail positive is acceptable if the probability of such is low.
> We can do it after or before color quantization (using GM'sImage.quantize() API).
> I have no idea how to do it at the moment so my question may sound vogue.

It seems that you are using Magick++.  At the C API level, there are 
the IsGrayImage(), GetImageType(), and GetImageCharacteristics() 
functions.  Out of these, it seems that only GetImageType() is exposed 
via the Magick++ API (image.type() method).  I just checked, and 
bilevel and grayscale are considered prior to palette so if the 
returned type is BilevelType, GrayscaleType, or GrayscaleMatteType, 
then the image is gray.

Bob
======================================
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword