Thank you fmw42, so if I use this command I can safely distinguish a color image from a grayscale's one:fmw42 wrote: Due to HSL being a double hexcone model [...] In its place, use HCL, HCLp, HSI or HSB above. These are all single hexcone type models and should work fine in the above equation.
Code: Select all
convert image -colorspace HSI -channel g -separate +channel -format "%[fx:mean]" info:
I have another question: how can I distinguish these three type of images:
![Image](https://s32.postimg.org/rai3n64x1/sshot.png)
1- is a rich color image (saturation ~ 40%)
2- is a grayscale image (saturation = 0%)
3- is a mostly two color gradient images (saturation ~ 15-30%)
both (1) and (3) have a quite high saturation value and so I can not distinguish between the two of them
![Sad :(](./images/smilies/icon_sad.gif)
My task is to process book pages (japanese comics), the cover is always colored and the pages are often grayscale but sometimes mostly two color gradient:
- - if the page is colored (like fig#1): keep colors, resize and convert to JPG
- if the page is grayscale (like fig#2): keep grayscale, resize and convert to GIF with dirthering
- if the page is mostly two color gradient (like fig#3): convert to grayscale GIF with dirthering
![Smile :)](./images/smilies/icon_smile.gif)