If the images are mostly white, with black (or some color) lines and text, you could check the histogram or mean statistic to see what percentage is white and use that as a threshold. The distribution of other colors might also help refine your work.smagdali wrote:It's well known that the jpg format is optimised for photography, and that lineart is not really appropriate for it.
On our site, we have many users who upload lineart or illustration as jpgs anyway, which causes problems for us, and reduced quality for them.
My question is, is there a way to detect, using imagemagick, whether a particular jpg is actually a photo or not?
(I understand that, given the range of possible inputs, it might not be 100% accurate, but something would be better than nothing)
stef
See string formats for %[mean], %[min], %[max], %[standard-deviation] at http://www.imagemagick.org/script/escape.php
See histogram at http://www.imagemagick.org/Usage/files/#histogram
Can you post some examples of both situations --- photos vs line art?