Rename iPhone images & video to use date/time

Charles Roth, 4 Oct 2017       (Techblog top)
Updated to include video, 12 Jan 2020
Updated to handle multiple images taken in the same second, 16 Aug 2020.
Updated to handle HEIC images, 4 Jun 2024.

I. Introduction
It's incredibly DUMB that the iPhone camera app names its images and videos IMG_0001, 0002, etc.  But what else can one expect from the Most Walled Garden in the world?

II. A Hack for Images
I save our best iPhone and Android photos to an on-line gallery based on ZenPhoto.  So I wrote a tiny shell script to extract the date and time from the image meta-data, and rename the image files accordingly. 

This script should work on MacOS, Windows with Cygwin, or (of course) Linux.

You can download the script makeIphoneImageNamesSensible and do whatever you like with it (just keep the attribution).  Feedback and improvements are welcome.

III. A Hack for Videos (with thanks to Mike L for inspiration)
Turns out this is pretty easy for iPhone-generated .MOV videos, as well.  However, it requires installing 'exiftool' as well (see exiftool.org/install.html.)

You can download the script makeIphoneVideoNamesSensible and do whatever you like with it (just keep the attribution).  Feedback and improvements are welcome.

IV. A Hack for HEIC (heh)
Convert all of those &?#!! HEIC images into jpegs with makeIphoneHeicImagesJpegs.

(Requires ImageMagick.)