Author Topic: What to look for to determine if the file was actually from a camera  (Read 2161 times)

grog808

  • Newbie
  • *
  • Posts: 5
Yes... I am a newbie...  I'm helping a friend try to recover her pics from a crashed hard drive (very crashed...)  Used Photorec and it found a ton of pics.  Most are probably cached stuff from web browsing.  She wants the pics that she took with her digital camera, iphone, etc. 

I'm trying to use ExifTool from a Perl script to discern what is a real photo.  I'm open to going the other way also... Maybe to look for what is NOT a photo (from her cam).  Modifying some examples I found online, i'm able to obtain Exif info from every file.  I'm suspecting that the junk from her web cache are the ones that just have the pixel dimensions and that's it.  Some files have what you would expect... lens info, did the flash fire, make of the camera, etc.

As a first pass, I just want to separate her pics from the cache.  Maybe moving them to a different directory., since I'm suspecting the vast majority is cache junk.

I thought I would try searching to see if "Make" was present, but apparently, I don't know how to tell.  Any Perl scripting wizards that could shed some light?

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3963
Re: What to look for to determine if the file was actually from a camera
« Reply #1 on: January 23, 2014, 03:57:02 PM »
You don't need to make a perl script to separate out photos, ExifTool can do this by itself.  For example, to move any photo that has a Make tag

ExifTool -if "defined $Make" "-directory</path/to/new/directory/" <DIR>

You didn't mention the system you're using, so change double quotes into singles if on mac or linux.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

grog808

  • Newbie
  • *
  • Posts: 5
Re: What to look for to determine if the file was actually from a camera
« Reply #2 on: January 23, 2014, 06:16:36 PM »
Thanks StarGeek!  I have a problem diving in too deep!  I just was browsing some of the other posts and was going to test something like that!

grog808

  • Newbie
  • *
  • Posts: 5
Re: What to look for to determine if the file was actually from a camera
« Reply #3 on: January 23, 2014, 07:28:40 PM »
I know i'm close...  I get the following on my testing...

Warning: No writeable tags set from /home/steve/Pictures/DSCN0733.JPG  (this file is actually the only one that has Make = Nikon)
    1 directories scanned
    2 files failed condition
    0 image files updated
    1 image files unchanged

there's 7 files in that Pictures directory, only 2 are jpeg.  The other jpeg file has no "Make" tag when queried by exiftool by itself.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3963
Re: What to look for to determine if the file was actually from a camera
« Reply #4 on: January 23, 2014, 08:50:11 PM »
What is the exact command you used?  Looks like you're not on a windows system, so did you single quotes instead of double quotes?
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

grog808

  • Newbie
  • *
  • Posts: 5
Re: What to look for to determine if the file was actually from a camera
« Reply #5 on: January 24, 2014, 12:47:07 AM »
i'm on ubuntu...

exiftool -if 'defined $Make' '-directory</media/BigBoy/pass1-sorted/good' /media/BigBoy/pass1-sorted/test/

slightly different now... i'm at home using a copy of files from the actual bad drive.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3963
Re: What to look for to determine if the file was actually from a camera
« Reply #6 on: January 24, 2014, 01:01:17 AM »
Oops, my mistake.  Change the "<" into an equals sign.  You use "<" if you're using a tag name, "=" if just setting it to a value.  That's why you get "No writeable tags set from /home/steve/Pictures/DSCN0733.JPG".  It's trying to use "/home/steve/Pictures/DSCN0733.JPG" as a tag.

So, this command should work (I think ;))
exiftool -if 'defined $Make' '-directory=/media/BigBoy/pass1-sorted/good' /media/BigBoy/pass1-sorted/test/
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

grog808

  • Newbie
  • *
  • Posts: 5
Re: What to look for to determine if the file was actually from a camera
« Reply #7 on: January 24, 2014, 01:06:23 AM »
worked like a charm!  You da Bomb, StarGeek!