how to intelligently place a crop box
June 27, 2012 3:55 PM   Subscribe

What command line tool should I be looking at for this slightly-intelligent batch image processing task?

I have a large collection of screenshots, all which contain the same element but in different positions, and I want to do a batch action to crop the relevant area from each. This region of the screen obviously contains different content in each image, but could be located by a few unique, static graphic elements within it, so I'm thinking of locating the particular graphic element in each by comparing it to a reference image, then using that element's position as the origin to draw a crop box. I'm sure there's some tool that can do this; I've looked through the ImageMagick docs and am not seeing this capability.

I'm asking for a command line utility only because I suspect that's where I'm most likely to find such a tool and because it would be easy to use for batch operations, but I'm on MacOS and would be happy to hear any other suggestions.
posted by brightghost to Computers & Internet (4 answers total) 2 users marked this as a favorite
 
Imagemagick is pretty much the standard for command-line batch processing images.

If you need to do more complex stuff (but I would bet imagemagick will do what you need to do) a bit of Python and the Python Image Library will take care of you.
posted by rockindata at 4:05 PM on June 27, 2012


I've looked through the ImageMagick docs and am not seeing this capability.
Reading comprehension fail. I still think you could do this in not very many lines of Python.
posted by rockindata at 4:07 PM on June 27, 2012


Best answer: This page should help get you started doing this in ImageMagick.
posted by pombe at 4:07 PM on June 27, 2012


Response by poster: Thanks so much pombe, that seems to be precisely what I'm looking for. Thanks for nothing rockindata— if you want to show me where Fred's Imagemagick Scripts are referenced in the imagemagick docs, justifying your rudeness, I eagerly await my education. Not that it would make your answering 'what command line tool could I use to do this' with 'just write your own, I'm sure it wouldn't be too hard' any more reasonable.
posted by brightghost at 5:08 PM on July 5, 2012


« Older Am I putting too much pressure on my head in this...   |   Help me choose a camera! Newer »
This thread is closed to new comments.