General Question

robmandu's avatar

Identify JPG files with EXIF information?

Asked by robmandu (21285points) March 5th, 2008

Recovering from a data salvage… and would like to find all of my original JPG files as were uploaded from my digital cameras. Figure simply culling out those JPGs with EXIF info would do the trick.

MacOS 10.5’s Spotlight can index that info… but I’m not sure I know how to limit the results to those in a specific directory (instead of across the entire system). Also, I think Spotlight might be a little too user-friendly… tagging EXIF info with more generic labels and possibly mixing that info with normal file attributes, like “Date picture was taken” in EXIF with “date file created” in OS.

JPGs being binary, I don’t think a shell script alone will work… but have seen some mention of EXIF functions in PHP.

Anyway, anyone else ever have to do this? Got any suggestions for me?

Observing members: 0 Composing members: 0

3 Answers

robmandu's avatar

btw… need something kinda scalable… the data salvage recovered 147,000 JPG files, of which only 28,000 were actual “printable” pictures (a large number are thumbnails, previous “versions” from iPhoto, and of course, legitimately deleted files that I don’t want back).

Trying to bring up a directory window in the OS with only 20,000 photos can be pretty slow… trying to get Spotlight to generate a complete results list can be even more painful.

To my way of thinking, the ideal solution would be some command-line utility that I can nohup and allow to run as long as it takes.

But again, I’m open to any and all suggestions.

rictic's avatar

I didn’t see any command-line exif information programs that would be useful to you, but a little bit of Ruby will go a long way here. It seems like you know a bit about programming, so here’s some example code that solves a simplified version of your problem, since you didn’t state how to distinguish the images you want from the ones you don’t.

First, install the exifr library. From Terminal:
sudo gem install exifr

Then save this code in a file named image.rb in a directory with all of the images to process:
http://pastie.caboo.se/166226

Feel free to message me if you want more info.

robmandu's avatar

@rictic, I’ve been looking for an excuse to get into Ruby. So I definitely will give your link some attention… I expect it likely could run faster than the other solution that I came across later in this saga.

Thanks!

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther