I am wondering whether there is a way to recognize (and possibly move/delete) B&W photos in folder containing both B&W and colored images? I am using Ubuntu Linux.
If you install ImageMagick, you can use the following command to test if something is greyscale:
So to go through them all and move:
However, this method only tests for the colorspace that an image is using. An image might be using a full RGB colorspace, while only actually using greyscale tones (ideally these would be converted to greyscale to be optimal).
In order to work out is just using grey tones, one option is to convert the image to HSL colour, then calculate the average saturation of an image. For a true greyscale image, the average saturation will be zero. With greyscale images in jpg, you are going to get a bit of deviation from perfect greyscale due to artefacts, and generally they aren't perfect depending on how they ended up black and white.
This image for example:
If we convert this to HSL and get the average saturation:
The figure output ranges from 0-1, so you would have to define a threshold under which you consider something to be greyscale depending on your source files.