Renaming and sorting through iPhone photos

Started by CloudedGenie, September 25, 2017, 08:49:28 AM

Previous topic - Next topic

CloudedGenie

I am sorting through the mess of several years' worth or iPhone/iPad photos to find the "most original" files. There are photos taken from my phone, uploaded to the cloud, with a copy sent to my husband, that he also backed up on his iPad, but never made any back-ups of the original photos he took... Apple merrily assigned IMG_xxxx (whatever the next index number was on the device it was saved) to the photo. Fortunately, there was only one period of 8 months where my husband and I had the same iPhone model ;-)

I manually sorted through a lot of the directories, inspecting the EXIF data to see which looked the "most untouched" to weed out duplicates.

With one of the iPhone 6 firmware updates came the ability to take in-camera HDR-photos (but also save the original JPG). The HDR photos are indicated in the maker notes by the tag HDRImageType with value "HDR Image" or "Normal Image". Earlier photos did not have this tag. The HDR and normal photos have the same timestamp.

I want to rename the files to add "-hdr" to the filename if it is an HDR-type photo, but cannot make it work in one pass. My renaming rule is as follows (I am on Windows):

exiftool -P -d %y%m%d-%H%M%S "-FileName<${DateTimeOriginal}_${Exif:Model;}-hdr.%ue" -if "${HDRImageType} eq 'HDR Image'" DIR

At the moment I have to run this at least twice, first without the "-if" rule, so that it can rename the files (most are not HDR). The files with duplicate time stamps fails with a "file already exists" error. I then run it with the -if statement to get the HDR files, and then again on any files that didn't get renamed the first time around, because the HDR file got the name first...

Please tell me there is a better way?


Windows 10
Nikon D800E, D200, D80, every iPhone produced, GoPro, some old compact cameras, and a mountain of scanned negatives and prints

Phil Harvey

You could try this:

exiftool -P -d %y%m%d-%H%M%S "-FileName<${DateTimeOriginal}_${Exif:Model;}${hdrimagetype;$_ = ($_ eq 'HDR Image' ? '-hdr' : '')}%-c.%ue" -m -if "$datetimeoriginal and $exif:model" DIR

The -m causes missing tag values to be set to an empty string.  Since this also applies to DateTimeOriginal and Exif:Model, I have added a -if statement to be sure these exist.

The %-c will add a copy number in the case where there is a duplicate file name.

- Phil

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

CloudedGenie

#2
Thanks Phil,

That works a treat!

It also makes it easier to identify the files where some of the Exif data got stripped off, probably during one of the trips to and from the cloud...

If I identify a given photo as the only full resolution copy that we have, and all of the other Exif tags appear to be there (other than the GPS location being stripped off), do you see any risk in adding the following fields back so that Lightroom will identify them correctly?

[EXIF:IFD0] Make
[EXIF:IFD0] Model
[EXIF:IFD0] ModifyDate

[Edit]: The fact that I recently discovered idImager damaged some of my old D200 raw files makes me super nervous (and angry...)!

- Christelle
Windows 10
Nikon D800E, D200, D80, every iPhone produced, GoPro, some old compact cameras, and a mountain of scanned negatives and prints

Phil Harvey

Hi Christelle,

I always recommend keeping backups of your original images.  If you are talking about writing EXIF to JPEG files, this is perfectly safe with ExifTool.  Any changes to RAW files are less safe.  But using ExifTool is MUCH safer than using any Nikon software in this respect.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).