Fix Google Photos Sort Order

I appreciate what Google Photos is and have enjoyed it for years, but … we’ve had a running disagreement on how to order photos for some time.

The rub 

Google photos uses a proprietary sort algorithm which uses photo metadata(embedded time stamps) and some hybrid of filenames to sort and order photos in a google photos album. Web searching for specifics of ‘how to fix photo sort order’ there are cagey and vague answers around google photos using a complex multi-variant algorithm and not really any specifics.

This is generally ‘ok’…BUT it falls flat in some situations and I’m running into these situations regularly with action photography.

I’m taking pictures of my son’s football games. My camera can take 3-5 frames per second during rapid fire shooting. When uploaded, the sort order in an album seems limited to the per-second resolution of the date/time stamp in the photo.

Example time stamp: 2020:09:05 12:54:44

Up to 5 photos can have this exact time stamp.

The EOS 77d has sub-second time stamping, but google photos seems to ignore this when sorting. Here’s the exif data(metadata) from a picture, note the sub second time stamp


This leads to the out of order sequences at the per second level and generally confusing slide viewing. 

Most of the game is in rough time order, but there are out of order jumbles. Notice that picture #3 in the sequence should be picture #1.


Solution from googling

“You can hand sort the albums!”

Sorta, but FALSE, and SHUT THE HELL UP!!!!

Hand sorting may work for a few dozen images, but things break down at scale.

I take 600-800 photos per game. Hand sorting the sequences side by side with the original filenames(image_001, image_002) takes a large monitor and over 3 hours per game.

The last game of the 2020 season was a great game, and I was willing to spend the time. I nearly lots my schnitzel near the end. Sorting photo 600-ish out of 800-ish I grabbed a single image and slid it into proper sequence order. 


The browser/Google photos/my mouse somehow grabbed many photos from the album, some many many rows up and moved them. This single action randomly un-ordering the 600 I had just spent hours wading through.


GOD DAMN #$!#!#!#!#!$@%@^!^@^@^@ …..KHHHHHHAAAAAAAANNNNNNNN!!!!! 

This was a breaking point.

Like any good IT nerd, when I’m annoyed my thoughts turn to:

I can code my way past this bullshit

Solution: Re-write time stamps to preserve shot order.

Algorithm

Look at directory of files, sort files by filename(image_001, image_002, … image_799)
Take the time stamp for the first photo(image_001) 

For every subsequent photo, image_002, add 1 second to the start time, then write the time stamp to the file

image_003 add 2 seconds

image_800 add 799 seconds

Then re-upload the album to google photos -> Viola.

Code for altering the exif time is on github

Now I just need to re-upload 6400 images to the 8 albums from this year. Please hold while I saturate my broadband uplink.

Update, I fought Google Photos and at best it’s a draw

Games 4-8 were corrected and uploaded and generally look as I’d hope.

For games 1-3, I used a program called ‘gwenview’ to import the photos. It has an ‘interesting’ naming convention rather than keeping the camera’s naming of image_001, image_002 etc.

I wrote something to sort/rename/re-time stamp these and uploaded the images and …CHAOS.

Despite having the correct names(image001) with a properly sequenced timestamp, google photos somehow realized the image itself was the same and it already had it from previous uploads.

Deleting the album doesn’t delete the photos, so I deleted the photos in the new albums, and immediately started the lengthly upload with confidence the new photos with good names and timestamps should sort properly.

WRONG->CLANK

Paging through the images, some of the images had their ‘old’ names, most had new. Most were in order, many were not. Google didn’t actually delete the data … it somehow had a memory of the old images with their presumably old and uncorrected time stamps.

I deleted the images from google photos(or so it says) and waited several hours.

I re-renamed the images from image_001 to newimage_001 and uploaded. New file names, new time stamps…this should work right?

-> MOSTLY sorted

99.5% sorted. Almost completely sorted. Are they absolutely sorted? <shrugs shoulders, looks at feet, shuffles, begins to whistle>

I found on one of the games with about 600 images, newimage_590 was chosen as picture #1 in the album, despite having the correct names and properly sequenced time stamp. No album edit/sort would get image_590 back to its proper place.

At this point, I’d spent a few days worth of spare time fixing games 1-3 and they are really really close to having the order I’d want. Panning through the images, there is a proper sense of the gameplay and I think I’ve learned enough to realize I’m at the mercy of Google’s opaque sort/retention algorithms.

Thesis

Next time, re-sequence everything PRIOR to their initial upload and the pictures will be in proper time order from the jump.

Do not taunt Happy Google Photos. Google photos has your photos they have their algorithms and you will not speak badly of Google Photos.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.