Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a bunch of images (screenshots), that I would like to sort automaticly in subfolders.

Since these are screenshots, I was thinking that I could program something that would read each jpg, check if such and such part of the image matches a specific set of pixels, and move the file accordingly.

What's the fastest way to accomplish that ? I have C# and python on my system.

share|improve this question
up vote 4 down vote accepted

Maybe you could create these "pattern images" (with any image editing software) and then iterate over all the images you want to sort "comparing" them against the "pattern images". Given the result of this operation (the similarity between the "pattern image" and the "actual image") you can put them in the specific subfolder.

The "compare" process can be done with ImageMagick's compare tool, and make decisions based on the return value of the metric used to compare both images.


share|improve this answer
How I didn't know that ImageMagick had a compare tool ! Maybe I can cut a part of the image, compare it with my sample and move the file, in a bash script... – Manu Jan 10 '10 at 13:28
I didn't know about this one, thanks Gaston. :) – mechko Jan 10 '10 at 13:59
It works ! convert 02.jpg -crop 80x10+738+867 +repage tmpcrop.jpg compare -metric PSNR image.jpg tmpcrop.jpg tmpcomp.jpg Where image.jpg is a previous cut of what I know is supposed to be there. Now all I have to do is package it inside a script. Thanks ! – Manu Jan 10 '10 at 14:22

You're best of going to stackoverflow with that one.

Do you know if each type of picture will have a certain image visible? I presume, being screenshots, you don't have the issue of things being scaled up and down randomly or at different angles.

It's actually a pretty intense program to run, but a naive implementation shouldn't be hard to write. Just build a tree of your emblems (things that identify each type of screenshot) and search for them pixel by pixel in the image. Or, just check the required locations for marks.

As for the language, I'd recommend NOT python. I don't C# is too bad with it, though. If you want, you can always install java and it's not too difficult to whip something up to do what you're asking. Hope this helps.

share|improve this answer
Thanks for the quick answer, i'll try moving it to stack. – Manu Jan 10 '10 at 13:14
no problem. I'll see you there ;) – mechko Jan 10 '10 at 13:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .