I have a folder of pictures that are JPEGs.

I am wondering if there is a automated way to sort out the ones that are photographs and ones that are pure graphics.

I am open to different software options.

  • 1
    This question appears to be off-topic because it is not about design and is a better fit for SuperUser.
    – Vincent
    Commented Nov 14, 2014 at 11:17
  • Thanks for all the advice and answers. I am not a designer or a software engineer. I am a hack. Up to this point, I have just been doing it by hand through thumbnails. Then I started to try histograms in ImageJ.
    – Henry Liu
    Commented Nov 14, 2014 at 22:24

1 Answer 1



The first answer is probably to manage the assets so that you don't have to sort them. Generally speaking there may be peculiar considerations depending on the object of such management, and so that extends to all sorts of assets. There is often reference to "software" and it surely exists, though often related to the software environment one adopts and less so about identification. Ultimately the discussion points back to managing the assets, and depending on the scale, values and resources, different choices will be made. There is no doubt there is value in thinking it through.

DIY identification

Considering a pool of images you have to sort. Aside from turnkey software you may find, there is material which may assist in the task. Depending on the files you have, it may also be possible to distinguish using a metadata/file naming element.1

One answer leverages shell scripting with the ImageMagick suite of utilities and color range like someone alluded to, to help distinguish between pictures and graphics, but this is not CV, so is not necessarily resilient, may not work well on small images, nor B&W. There may be other constraints but it is worth trying out if that's accessible for you(Linux, OSX). The solution is reproduced and updated here.

Another approach relies on OpenCV to operate transformations on the hue channel of an image in HSV mode and compare with an original; it leverages how mathematics affects illustration types. The approach is accessible and may require tuning by someone with a greater command of the image and color fundamentals as applied to computer vision. The initial approach described is implemented and expanded upon here.

Neither methods rely on training or object recognition. One is free to go further if he/she chooses to.

1.Ask on the appropriate forum for your platform, such as SuperUser, Ask Different, and U&L.

  • Now your answer is completely different :) In essence managing the tagging is the best solution. However its also a loosing proposition in big organisations. I have done research on cad categorisarion Which admittedly is harder. But the key is if the system is not automated some of it will not be handled properly. And that can be worse than having some of it handled properly. So automatic has a quality of its own.
    – joojaa
    Commented Nov 18, 2014 at 7:46
  • @joojaa Thank you for your comment! I went pretty much full circle with the content. Surely more and more this has evolved into CMS etc. and is no longer task based very much, as it is more about workflow and business process, hosting etc. In my case it was a great opportunity to install OpenCV, play with files and such lol. I find the material enabling and showcases "horizontal" content...
    – user29318
    Commented Nov 18, 2014 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.