{"id":2840,"date":"2020-11-08T14:53:55","date_gmt":"2020-11-08T14:53:55","guid":{"rendered":"http:\/\/www.pasko.net\/wordpress\/?p=2840"},"modified":"2020-11-08T14:53:55","modified_gmt":"2020-11-08T14:53:55","slug":"fix-google-photos-sort-order","status":"publish","type":"post","link":"https:\/\/www.pasko.net\/wordpress\/2020\/11\/08\/fix-google-photos-sort-order\/","title":{"rendered":"Fix Google Photos Sort Order"},"content":{"rendered":"<p id=\"top\" \/>\n<p>I appreciate what Google Photos is and have enjoyed it for years, but &#8230; we&#8217;ve had a running disagreement on how to order photos for some time.<\/p>\n\n\n\n<p>The rub&nbsp;<\/p>\n\n\n\n<p>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.\u00a0Web searching for specifics of &#8216;how to fix photo sort order&#8217; there are cagey and vague answers around google photos using a complex multi-variant algorithm and not really any specifics.<\/p>\n\n\n\n<p>This is generally &#8216;ok&#8217;&#8230;BUT it falls flat in some situations and I&#8217;m running into these situations regularly with action photography. <\/p>\n\n\n\n<p>I&#8217;m taking pictures of my son&#8217;s football games. My camera can take 3-5 frames per second during rapid fire shooting. When uploaded, <strong><em>the sort order in an album seems limited to the per-second resolution of the date\/time stamp in the photo<\/em><\/strong>.<br><\/p>\n\n\n\n<p>Example time stamp:  <strong>2020:09:05 12:54:44<\/strong><\/p>\n\n\n\n<p>Up to 5 photos can have this exact time stamp.<\/p>\n\n\n\n<p>The EOS 77d has sub-second time stamping, but google photos seems to ignore this when sorting. Here&#8217;s the exif data(metadata) from a picture, note the sub second time stamp<\/p>\n\n\n\n<p><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.pasko.net\/wordpress\/wp-content\/uploads\/2020\/11\/Screenshot_20201106_095408-365x1024.png\" alt=\"\" class=\"wp-image-2844\" width=\"286\" height=\"802\" srcset=\"https:\/\/www.pasko.net\/wordpress\/wp-content\/uploads\/2020\/11\/Screenshot_20201106_095408-365x1024.png 365w, https:\/\/www.pasko.net\/wordpress\/wp-content\/uploads\/2020\/11\/Screenshot_20201106_095408-107x300.png 107w, https:\/\/www.pasko.net\/wordpress\/wp-content\/uploads\/2020\/11\/Screenshot_20201106_095408.png 442w\" sizes=\"auto, (max-width: 286px) 100vw, 286px\" \/><\/figure>\n\n\n\n<p>This leads to the out of order sequences at the per second level and generally confusing slide viewing.&nbsp;<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p><br><\/p>\n\n\n\nngg_shortcode_0_placeholder\n\n\n\n<p><strong>Solution from googling<\/strong>      <\/p>\n\n\n\n<p>  &#8220;You can hand sort the albums!&#8221;<br><br>Sorta, but FALSE, and <strong>SHUT THE HELL UP!!!!<\/strong><br><br>Hand sorting may work for a few dozen images, but things break down at scale. <\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>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.\u00a0<\/p>\n\n\n\n<p><br>The browser\/Google photos\/my mouse somehow <strong><em>grabbed many photos from the album, some many many rows up and moved them.<\/em><\/strong> This single action randomly un-ordering the 600 I had just spent hours wading through.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><br>GOD DAMN #$!#!#!#!#!$@%@^!^@^@^@&nbsp;&#8230;..KHHHHHHAAAAAAAANNNNNNNN!!!!!&nbsp;<br><\/h2>\n\n\n\n<p>This was a breaking point. <\/p>\n\n\n\n<p>Like any good IT nerd, when I&#8217;m annoyed my thoughts turn to:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">I can code my way past this bullshit<\/h2>\n\n\n\n<p><strong>Solution:<\/strong> Re-write time stamps to preserve shot order.<br><br><strong>Algorithm<\/strong><\/p>\n\n\n\n<p>Look at directory of files, sort files by filename(image_001, image_002, &#8230; image_799)<br>Take the time stamp for the first photo(image_001)\u00a0<\/p>\n\n\n\n<p>For every subsequent photo, image_002, add 1 second to the start time, then write the time stamp to the file<\/p>\n\n\n\n<p>image_003 add 2 seconds<\/p>\n\n\n\n<p>&#8230;<\/p>\n\n\n\n<p>image_800 add 799 seconds<br><\/p>\n\n\n\n<p>Then re-upload the album to google photos -> Viola.<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/jpasko1\/fix_google_photos_sort_order\" target=\"_blank\">Code for altering the exif time is on github<\/a><\/p>\n\n\n\n<p>Now I just need to re-upload 6400 images to the 8 albums from this year. Please hold while I saturate my broadband uplink.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update, I fought Google Photos and at best it&#8217;s a draw<\/h2>\n\n\n\n<p>Games 4-8 were corrected and uploaded and generally look as I&#8217;d hope.<br><br>For games 1-3, I used a program called &#8216;gwenview&#8217; to import the photos. It has an &#8216;interesting&#8217; naming convention rather than keeping the camera&#8217;s naming of image_001, image_002 etc. <br><br>I wrote something to sort\/rename\/re-time stamp these and uploaded the images and &#8230;CHAOS. <br><br>Despite having the correct names(image001) with a properly sequenced timestamp, google photos somehow realized the image itself was the same and <strong><em>it already had it<\/em><\/strong> from previous uploads.<\/p>\n\n\n\n<p>Deleting the album doesn&#8217;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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">WRONG->CLANK <\/h2>\n\n\n\n<p>Paging through the images, some of the images had their &#8216;old&#8217; names, most had new. Most were in order, many were not. Google didn&#8217;t actually delete the data &#8230; it somehow had a memory of the old images with their presumably old and uncorrected time stamps.<\/p>\n\n\n\n<p>I deleted the images from google photos(or so it says) and waited several hours.<\/p>\n\n\n\n<p>I re-renamed the images from image_001 to newimage_001 and uploaded. New file names, new time stamps&#8230;this should work right?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">-> MOSTLY sorted<\/h2>\n\n\n\n<p>99.5% sorted. Almost completely sorted. Are they absolutely sorted? <em>&lt;shrugs shoulders, looks at feet, shuffles, begins to whistle><\/em><\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>At this point, I&#8217;d spent a few days worth of spare time fixing games 1-3 and they are really really close to having the order I&#8217;d want. Panning through the images, there is a proper sense of the gameplay and I think I&#8217;ve learned enough to realize I&#8217;m at the mercy of Google&#8217;s opaque sort\/retention algorithms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Thesis<\/h2>\n\n\n\n<p>Next time, re-sequence everything PRIOR to their initial upload and the pictures will be in proper time order from the jump.<\/p>\n\n\n\n<p>Do not taunt Happy Google Photos. Google photos has your photos they have their algorithms and you will not speak badly of Google Photos.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I appreciate what Google Photos is and have enjoyed it for years, but &#8230; we&#8217;ve had a running disagreement on how to order photos for some time. The rub&nbsp; Google photos uses a proprietary sort algorithm which uses photo metadata(embedded &hellip; <a href=\"https:\/\/www.pasko.net\/wordpress\/2020\/11\/08\/fix-google-photos-sort-order\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[40,39],"class_list":["post-2840","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-googlephotos","tag-photography"],"_links":{"self":[{"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/posts\/2840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/comments?post=2840"}],"version-history":[{"count":28,"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/posts\/2840\/revisions"}],"predecessor-version":[{"id":2875,"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/posts\/2840\/revisions\/2875"}],"wp:attachment":[{"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/media?parent=2840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/categories?post=2840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pasko.net\/wordpress\/wp-json\/wp\/v2\/tags?post=2840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}