I want to be able to control the order of the images that are displayed in a Photo Album. I do not want them to be displayed vertically as well. The use-case is to upload scanned images one by one and have them show in that order such that the person viewing the album can look at them in that same order. Is there a way to do that?

  • did you try to rename them if the ordering obeys the A-Z chrono order? – user0 May 27 at 16:05
  • Good question: I did expect that it would obey the lexicographical order of the filename itself, but I tested it out by creating a new photo album from a bunch of images with numeric page numbers embedded in the file names, and it seemed to just list them in reverse order. Perhaps because the file timestamps will be in that order due to my conversion software I'm using. So I will recheck it by artificially changing the timestamps to be such that it maintains the same lexicographical ordering of the filenames themselves, and report back here. – bgoodr May 27 at 17:59
  • @user0 That worked splendidly. I had to cook up a script to change the timestamps on the files with a 60s difference in each, in reverse chronological order, but now the images show exactly how I want them to. If you post an answer, I'll mark it as the correct answer! – bgoodr May 27 at 19:53
  • glad it helped. – user0 May 27 at 20:52
  • 1
    done. updated... – user0 May 28 at 0:20

One way would be to rename all your images in such a way that your desired order would match with lexicographical order of modification stamps on the filesystem when uploading from the host to the Google Photos as most of the Google products obey such sorting by default.


Unfortunately, we had thought that @user0's answer in https://webapps.stackexchange.com/a/130189/14529 was sufficient. But I tried using that approach again and found it did not work. I speculate that at one time it did actually work, because I tested it out, but as of 2018-08-26, it does not affect the ordering.

So, from further experimentation, I determined that the GPS date/time stamp EXIF tags in the image files are what Google Photos seems to use for sorting the images in the album, and seems to ignore the modification or creation date EXIF tags.

So in order to fix this, in Ubuntu, I used the exiftool (you can install it via sudo apt install exiftool) in the following script (explanation follows afterwards):



t0=$(date +"%s")
find $in_dir -type f | sort -r -n | while read file
  echo "Processing $file ..."

  # Get the date/time stamp for the -AllDates option:
  t0_datetime=$(date -d "@$t0" +"%Y-%m-%d %H:%M:%S")

  # Get the date/time stamps for the -GPSDateStamp and -GPSTimeStamp options:
  t0_date=$(date -d "@$t0" +"%Y-%m-%d")
  t0_time=$(date -d "@$t0" +"%H:%M:%S")

  # Modify the EXIF tags for those dates, making them all the same:
  #   It is not understood why -AllDates doesn't also modify the GPS date/time stamps.
  exiftool -AllDates="$t0_datetime" -GPSDateStamp="$t0_date" -GPSTimeStamp="$t0_time" -overwrite_original $file

  # Modify the filesystem date/time stamps:
  #   This is likely not really necessary but do it anyhow for consistency when examining the file listing on Linux:
  touch -d "@$t0" "$file"

  # Go in reverse, by bumping back by a minute:
  ((t0 = t0 - 60))

What this script does: Find all of the image files (which should have names that sort lexicographically such as having page numbers of 001, 002, etc), sort them in reverse numerical order for those page numbers (sort -r -n), and calls the exiftool on each one to set the date/time stamp EXIF tags. Each date/time stamp is separated by 60s (1 min), and I've not experimented with other time deltas to see if it matters. For my purposes of forcing Google Photos to sort them in order, the particular date doesn't matter, so I started with the current date and work backwards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.