Page 1 of 1

Re: detecting non-photographic imagery in .jpg files

Posted: 2009-03-04T11:28:19-07:00
by fmw42
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
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.

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?

Re: detecting non-photographic imagery in .jpg files

Posted: 2009-03-04T16:41:19-07:00
by anthony
I have some notes of ideas people have had on determine different types of images.
generaly so this was for image comparing but you have the same type of problem.

See Comparing Images, Sorting Images by Type
http://www.imagemagick.org/Usage/compare/#type_general

I would look specifically on Cartoon vs Real Life though not much is there.

If you or others have been practical ideas for categorizing images please post or mail me.