Batch Change Time Mac Photos App

15 11 likes 26,887 views Last modified Dec 23, 2018 3:51 AM

This version of the script is no longer maintained, because the old code cannot be edited in the new version of the AppleSupport Communities platform.

Change Photo Date with XnView. Before we can attempt to change a photo date and time, we need. Photography StackExchange user Rabarberski writes. Using Picasa it’s very easy to either shift or set the date of a batch of photos. And it’s cross-platform (Windows, OSX and Linux). See Import photos from Mail, Safari, and other apps. By default, imported photos are copied into the Photos library. If you prefer, you can store photos and videos outside the Photos library—for example, in a folder on your Mac or on an external hard drive—and still view them in Photos. If you ever need to move content stored outside the.

Mac

Tweak Photos is a batch editing app that offers plenty of features to optimize and enhance your images. The app is simple to use thanks to the intuitive layout and breaks it all down in easy-to-follow steps: add photos, apply the desired effects and select your Save options. Batch JPEG Date Changer is now Batch MMedia Date Changer. The name change is made to better reflect what the app has evolved to become. Have you been in a situation when you replaced the camera batteries and forgot to change the camera clock to the current date and time or set the wrong date o.

Please use the new version of this user tip here: Script: Batch Change the Date and Time to a Fixed Date


------ obsolete --- ignore

This batch change option is missing in Photos. Here is a little Apple Script, that can be run to batch change the dates like in iPhoto. If you still have iPhoto installed, simply use iPhoto to batch change dates. If your Photos Library is large or you are syncing your library with iCloud Photo Library, scroll down to version 2 of this script. Apple has added some powerful functionality to the built-in Photos app in macOS over time, but despite these improvements, it’s still lacking several key features. One such feature is the ability to batch edit multiple photos at once, applying the same corrections to a group of photos without needing to edit them one-by-one.

iPhoto had the very convenient Batch Change tool to set the date and time of all selected photos to a fixed date, with a time increment added between successive photos. This was very convenient for older photos, that had no capture date embedded. This batch change option is missing in Photos. Here is a little Apple Script, that can be run to batch change the dates like in iPhoto. If you still have iPhoto installed, simply use iPhoto to batch change dates.


If your Photos Library is large or you are syncing your library with iCloud Photo Library, scroll down to version 2 of this script. It will be more robust.

To copy and paste it: (* Batch change the time of selected photos all at once
How to use this script: - Collect all photos you want to set to the same time in an album and sort them manually - Adjust the time of the first of your batch of photos with 'Adjust Date and time' in Photos from the 'Image' menu, even if the time is correct - Select first the photo with the adjusted date, the hold down the Shift key and select all photos you want to set to the same date and time at once. You need to select at least two photos. - Open this script and run it by pressing the 'Run' button. - The script will copy the date from the first image and set all photos to the same date, and step the date by adding the increment given by the variable timeIncrement. - The script will return the last date it changed
- if you save this script as an Application you can add it to the Dock and run it from there
Note - for some photos it may not be possible to change the time, then running 'Adjust date and time' for all photos once may help. Photos has a bug that displays timezones incorrectly, so the results may look wrong, if the photos have been taken in different timezones.
This script has been tested in Photos version 1.0, with MacOS X 10.10.3
© Léonie *)
set timeIncrement to 1 -- the time increment in minutes (* select at least 2 images in Photos *) tellapplication 'Photos' activateset imageSel to (get selection) if (imageSel is {}) or (the length of imageSel < 2) thenerror 'Please select at least two images.' else
set first_image toitem 1 of imageSel set first_date to (thedateof first_image) asdaterepeatwith i from 2 tocountof imageSel
set next_image toitemi of imageSel set next_date to (thedateof next_image) asdate
set time_difference to (first_date - next_date) + ((i - 1) * timeIncrement * minutes)
tell next_image setthedateof next_image to (next_date + time_difference) asdateendtell

endrepeatendifreturn 'Adjusted the date and time of ' & (the length of imageSel) & ' photos. The last date is ' & ((thedateof next_image) asdate) endtellVersion 2 - pass photos in an album:

The version above lets you select the photos to be batch changed directly in the All Photos album, but the 'get selection' command is not very reliable in Photos. If your Photos library is large or you are using iCloud Photo Library the script above may give timeout errors.If that should be the case, this second version might work better. Only it requires, that you collect all photos to be processed in a fixed album, defined at the top level of the Photos Library. I tested this version on my iCloud Photo Library, that has 37000 photos, and so far it worked.And you have to define the name of this album in the script as a constant. This fix has been suggested by NicFletcher - his sample script uses this method:https://discussions.apple.com/thread/6999613?answerId=28087786022#28087786022

Apple Photos Batch Change Date


(* Batch change the time of selected photos all at once

How to use this script:- Collect all photos you want to set to the same time in an album and sort them manually to the sequence you want.- The album needs to be a toplevel album, not an album inside a folder.- Adjust the time of the first of your batch of photos with 'Adjust Date and time' in Photos from the 'Image' menu, even if the time is correct. to ensure it has an EXIF capture date.- Open this script and run it by pressing the 'Run' button.- The script will copy the date from the first image and set all photos to the same date, and step the date by adding the increment given by the variable timeIncrement.- The script will return the last date it changed

- if you save this script as an Application you can add it to the Dock and run it from there

Note - for some photos it may not be possible to change the time, then running 'Adjust date and time' for all photos once may help. Photos has a bug that displays timezones incorrectly, so the results may look wrong, if the photos have been taken in different timezones.- Enter the name of your album in the first line of the script instead of 'PhotoDropBox'

This script has been tested in Photos version 1.0, with MacOS X 10.10.3

© Léonie*)

set theAlbumName to 'PhotoDropBox' -- the photos will be passed in a toplevel album named 'PhotoDropBox'

set timeIncrement to 1 -- the time increment in minutes

set imageSel to {}

tellapplication 'Photos'

activate

try

ifexistscontainertheAlbumName then

set thePhotosBuffer tocontainertheAlbumName set imageSel toeverymedia itemof thePhotosBuffer elseerror 'Album ' & theAlbumName & 'does not exist' endif

onerror errTexttwonumbererrNumtwo display dialog 'Cannot open album: ' & errNumtwo & return & errTexttwo endtry


if (the length of imageSel < 2) thenerror 'Please select at least two images.' else

set first_image toitem 1 of imageSel try

tell first_image set first_date toitsdateendtellonerror errText number errNum display dialog 'Error: ' & errNum & return & errText & 'Trying again' trydelay 2 tell first_image set first_date toitsdateendtellonerror errTexttwonumbererrNumtwo error 'cannot get the date of the first image' endtryendtry

-- set first_date to (the date of first_image) as date

repeatwith i from 2 tocountof imageSel

set next_image toitemi of imageSel trytell next_image setitsdateto first_date + ((i - 1) * timeIncrement * minutes) endtellonerror errText number errNum display dialog 'Error: ' & errNum & return & errText & 'Trying again' trydelay 2 tell next_image setitsdateto first_date + ((i - 1) * timeIncrement * minutes) endtellonerror errTexttwonumbererrNumtwo display dialog 'Skipping image due to repeated error: ' & errNumtwo & return & errTexttwo endtryendtryendrepeatendifreturn 'Adjusted the date and time of ' & (the length of imageSel) & ' photos. The last date is ' & ((thedateof next_image) asdate)endtell

April 18, 2018

I have thousands of photos in a perfect, organized state with correct EXIFmetadata. However, this was not the case couple of years ago.

Not all of my photos had proper EXIF data. Some had EXIF metadata but wereincorrectly named, some didn’t have EXIF metadata, but I knew the time they weretaken and most of them had filenames with random numbers based on the camerashutter count.

Because I didn’t like the state of all my photos, I’ve decided to fix them.During this time, I’ve gathered a set of small, short code pieces that allowsme to change anything on a set of photos.

Before we dive in, please be cautious with the commands, some of them aredisastrous. Always do a backup before you start working manipulating the data.One final reminder, all the commands are only used on macOS, it might bedifferent based on what OS you use.

Now, let’s dive in:

Install tools

exiftool is a command linetool that allows you to change and manipulate the EXIF metadata of images. On macOSyou can easily install it with:

detox is a utility designed to clean upfilenames. It replaces difficult to work with characters, such as spaces, withstandard equivalents. It will also clean up filenames with UTF-8 or Latin-1 (orCP-1252) characters in them (i.e: foo bar - quz.avi -> foo_bar-quz.avi).This will come handy for scripting because you don’t have to escapewhite spaces in your files. To install:

Make a backup of your photos folder

Instead of using cp, it’s better to use a tool that is faster and copesbetter with file permissions. To make a backup of your photo folder run:

These flags mean:

  • v increases verbosity.
  • a applies archive settings to mirror the source files exactly, includingsymbolic links and permissions.
  • E copies extended attributes and resource forks (OS X only).
  • progress provides a countdown and transfer statistics during the copy

Remove all white spaces in filenames

Assuming all your photos are in one place, to remove all white spacesrecursively, run the following:

Find images without an EXIF metadata

The first mistake when editing batch EXIF metadata is assuming that all images haveEXIF metadata. That’s not always the case. To find all images (in JPEG) withoutany date run the following, recursively:

verify:

Set EXIF date based on file modify date

Suppose a photo does have an incorrect date or no EXIF metadata. But you know thatthe modified date of the file is correct because that’s is the date the photowas created. To update the EXIF date based on this date, call:

Change EXIF date by shifting timezone

Sometimes I forgot to change the time of my camera when I travel and I shoot inmy local timezone. When this happens, I have to change all my photos and updateit with the correct timezone. The following examples shifts the time by -11hours (suppose local time is 10:00 PM, Photos will be adjusted to 11AM(previous day)). Change it according to your own needs:

Batch Change Time Mac Photos App Free

Set the file modification date based on EXIF date

With the previous action, the EXIF date might be correct, but now the modified date is set to the date the tool was invoked. To fix the modified date of the file that was destroyed with the previous action, run:

Set EXIF date based on the file name

If you have a file with the name foo_20180418_103000.jpeg (which is in the formatYYYYmmdd_HHMMSS), but the EXIF date is incorrect, you can update the EXIF date from the filename with:

The format needs to be similar to the format above

Set file name based on the EXIF date

If you have a correct EXIF date, you can easily rename all files based onthe EXIF date of the file:

Set file name based on the file modified date

If you have a correct modified date, you can easily rename all files based onthe modified date of the file:

Rebuild and fix corrupted EXIF metadata

Sometimes exiftool refuses to operate on a photo because of the EXIF metadata beingcorrupted. To fix all photos recursively, run:

Filter out non JPEG files

Your photos/ folder might contain various kind of data, such as videos, gif,png images, etc.. Let’s filter out all non JPEG files.

The file let us find the mime type:

gives us this:

Batch Change Time Mac Photos App

Batch Change Time Mac Photos App Desktop

let’s pipe it to awk to get the filename:

gives us:

to strip last char (:) we use substr

this gives us:

To pick up files that are not of mime type image/jpeg, we can use $NFbuiltin variable, which prints the last field in a line and compare it toimage/jpeg. If it’s not equal to it, we’re going to continue parsing thefile:

which gives us:

Now to list all files with inside the current directory you should run:

combining this with the awk directive above and direct the result to afile called nonjpeg.txt, we get:

As a bonus, this is how you can iterate over the files in nonjpeg.txt andmove it to a new folder called others:

Recursive action: * vs .

Some of the example above uses * or . for selecting all files recursively.The difference is that * is a bash expansion. If you have hundreds of files,this won’t work as it fails after a threshold. Using . is better, because inthat case exiftool automatically selects the files.

Moving without overwriting

You might want to move files to a folder after fixing the issues. It’s possibleto have a duplicate filename due to the way your EXIF metadata was created.

Mac Photos Batch Change Date

To avoid overwriting with mv, use the -n flag. This will not move if a fieldwith the same name exists. As a bonus, I also use -v so it shows me theprogress (this is not very useful actually as it’s moving very fast, but I seethat mv is working when I use it in a script, iterating over thousands of files)

Find files newer than given date

You can use find to get a list of files that are newer than the given data.For example, the command below will give you a list of all files that are newerthan Jun 18, 2017:

Batch Change Date Photos Mac

I’ve found these little snippets very useful for a folder with thousands ofunorganized photos with corrupted and missing EXIF metadata. These are meant tobe combined with each other depending on the files you have. Use one that fitsyour workflow.

Batch Change Time Mac Photos App Windows 10

If you have any questions or feedback, please feel free to share it with me on Twitter: @fatih