so

iCloud photos

Volume 7, Issue 48; 16 Dec 2023

TIL: How to copy photos out of the Apple cloud.

This post has been replaced.

The background for this effort is my dissatisfaction with Dropbox. I used Dropbox for many years. I liked it will enough to pay for it for a while. But not so much anymore. And the opted-in-by-default AI crap utterly destroys any trust I might have had in the service. Time to delete that app.

All I’ve really used Dropbox for recently is syncing photos off my phone onto my laptop. Apple’sTo be clear, I don’t exactly trust Apple either. But I certainly don’t trust Google. For better or worse, I have an iPhone rather than an Android one at the moment. I plan to look at Fairphone next time I need a replacement, but that’s a ways away. going to put them in iCloud, surely I can just get them from there?

[Photo]
More Christmas cactus blossoms

I’ll just bang up a quick Python script to do that.

Step 1, open up the macOS Photos app, which I otherwise almost never use, go into settings, and configure it to store originals on this Mac. Now when I start Photos it’ll copy the images from the iCloud onto my laptop.

Where?

Under ~/Pictures/Photos Library.photoslibrary/originals, apparently 🙄.Nothing in this post is official in any way. YMMV. Apple will probably break it periodically. But it works today. For me. That directory contains sixteen directories named 0 to F. In the 0 directory, we find all the images that have random names that begin with 0, like 099B0E3E-EC2D-4675-87E7-BC7D25033E82.heic. In the 1 directory, all the random names that begin with 1, etc.

Step 2, start by finding all the files under originals, using the last modified date/time to screen out all the ones more than a week or so old, when I last copied them over with Dropbox. I’ll squirrel away a little metadata locally for the ones managed by my syncing script going forward.

Step 3, the Pillow library will read the files and let me get EXIF data out of them to find the date/time when each photograph was taken. (If that’s available, I prefer a semi-random name that includes the timestamp over the utterly random names generated by the phone.)

An hour or so in, it mostly works. I run some tests with a couple of different camera apps and I make an amusing discovery. When Photos says “originals”, it means originals. The original version of a photo I snapped with Hipstamatic is just that: the original. A crisp, clear image in full color. Not the grainy pseudo-tintype image I thought I took.

[Photo]
The "tintype" original

Pro: that’s really cool. I can get the originals! Con: Uh, I actually want the fake tintype one. Or the one I otherwise edited on my phone.

[Photo]
Pseudo-tintype cactus

A little more digging reveals that the rendered images, the originals with manipulations applied, are stored in ~Pictures/Photos Library.photoslibrary/resources/renders. There’s even a nice XML “plist” file in there that presumably contains the manipulation instructions. Will have to come back to that someday.

Step 4, collecting up and copying the rendered versions requires a tiny bit of care as I’d like them to “go with” the originals. I use the photo timestamp of the original and add a trailing keyword to the name.

That’s it, really.

Oh, except for this one bit. Photos captures all the images that pass through your hands, even ones that, for example, you copy out of a Mastodon post to share in another app.

Some of those are going to be in weird formats that don’t have EXIF metadata. The filenames are meaningless, so it would be really nice if the warning could show me the image. Except, this is a shell script, so how is that going to work?

Turns out my terminal emulator of choice, iTerm, can render images inline. So I do that.

[Photo]
iTerm screenshot

Step 5, eye candy. Which is kind of neat. Also Blåhaj.

#Apple #Photography #TIL