recognize grayed image from coloured ones

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

A grayscale image returns a colorspace of gray with the identify -verbose command.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

IM Examples had a few image type comparsions, how greyscale an image is on one test, mostly black or white is another that is covered.
Determining the Type of an Image
http://www.cit.gu.edu.au/~anthony/graph ... #imagetype

Hmmm Color image...

Code: Select all

convert capitol.jpg \( +clone -colorspace gray \) \
             -compose difference -composite \
            -colorspace gray -verbose info: | grep 'Mean:'

Code: Select all

Mean: 2658.12 (0.0405603)
Black and white....

Code: Select all

convert  black-and-white-photographs-3003.jpg \( +clone -colorspace gray \) \
             -compose difference -composite \
            -colorspace gray -verbose info: | grep 'Mean:'

Code: Select all

Mean: 0 (0) 
Obviously the later is pure greyscale, while the former shows a 4% average non-grey
difference. This is however an average, and "compare" could be used instead to
get peak differences as apposed to an average difference.

However I would love to learn about the exact method you have come up with for typing images. Cartoon or Anime typing for example would be particularly useful to know about.

Please share what you have come up with.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply