Playing around with Immich again

Immich Logo

Immich is a self-hosted Google Photos. That’s the simplest way to describe it. It can run in a Docker container and will happily live on your local network, without access to the Internet unless you want to. They do warn you that, “The project is under very active development”, so bugfixes are happening all the time. At the same time, bugs are sometimes introduced, and breaking changes are sign posted weeks in advance.

Immich. How do you pronounce it? I say it with a hard “CH” at the end, but others will say it sounds more like “image”, which leads me to think that’s probably the way to pronounce it.

It looks uncannily like Google Photos. It doesn’t have all the bells and whistles of it’s older, proprietary inspiration, but it does have some very useful features.

I love the face and object recognition in Immich. I can search by people on the Explore page, and search for objects too. It doesn’t present animals on the Explore page, but searching for “chihuahua” leads me to lots of photos of Diego. It’s face recognition that doesn’t go to feeding a gigantic corporation too. It works pretty well, but make sure your Docker install has enough RAM, or it will silently fail.

A screenshot of the Immich mobile app showing a search for chihuahua and thumbnails of my dog.

It has partner sharing too, which is of course a handy feature for families. I noticed that partner shared photos can’t be discovered through the Explore page, where you find face recognition and places. There’s a GitHub issue about this, so it’s something they’re aware of. To be fair, Google Photos has the same limitation (I think) unless you’ve copied the photos to your account, using your precious free space.

To get around this limitation, I symlink any shared photos to my wife’s account. I use External Libraries for 99% of my photos, and 100% of the photos that come from Adobe Lightroom. I export photos to “single” or “shared” directories, and a shell script moves them all to my Immich External Library, and symlinks the shared photos to my wife’s one. On the External Libraries admin page, I simply “Scan new library files” to import the symlinked files. Immich is smart enough to pick up the new files in my External Library. Files are scanned twice, with thumbnails made twice, and face recognition done twice, but the overhead in space used isn’t too bad.

The Quick Start docs tell you to use Docker to install, and if you are at all familiar with Docker, this should be easy enough to follow.

When you do get Immich installed, make sure you perform backups. I have all the images stored elsewhere, but I back up the database file with the docker command listed on that page. Syncthing copies it to another machine, where it’s backed up daily.

Another option is the Nextcloud Memories app which is very slick and looks great. It has face and object recognition too, but it depends on another Nextcloud app to do those jobs. It doesn’t have partner sharing, however, which is the main reason I tried out Immich.

If you do decide to expose your Immich install to the Internet, take a look at Cosmos Cloud. There are other options too, like Caddy or Nginx Proxy Manager. Getting an HTTPS certificate has never been easier. If you don’t know your IP, have a look at https://checkip.amazonaws.com too.

TIL to search date ranges in Google Photos

I learned something new about Google Photos. I can examine the photos taken between two dates by entering :YYYYMMDD-YYYYMMDD in the search box.

I have images going back more than twenty years in Google Photos so a way to view a selection of those images is really useful!

St Patrick’s Day, 2019

I haven’t been using Google Photos as much since they added space limitations, but this search will still be useful!

Save space by resizing Google Photos

On the 1st of June 2021, Google Photos stopped offering free storage.

Google Photos is a fantastic service, but at the rate I take photos I knew I’d fill the remaining gigabytes of storage in a matter of months, so I stopped uploading photos from my phone.

I don’t regard Google Photos as a backup system for my photos. I use Backblaze for that, where everything is backed up from my desktop computer. Google Photos is very useful for sharing albums, the face recognition is amazing, and utilities like HDR photo generation and time lapses are nice bonuses.

In Lightroom, I would resize images to 16MP before uploading them to Google Photos. Those files are still huge compared to what you really need. They are likely only going to be seen on a screen, either phone or laptop. So recently I started to resize them to 1280 pixels on the longest side. Instead of a 6,000Kb file, I now upload a 600Kb file. On my phone screen it looks much the same, and I have the original on my computer anyway!

What I really wanted is for my phone to resize the images I shoot and then allow Google Photos to upload them. It would have to do something like this:

  1. Check the DCIM/Camera directory for new photos, and move them to a work directory.
  2. Go through those images, resize them and copy the location EXIF data from the original images.
  3. Save the resized images to a new directory in DCIM where Google Photos will back them up.
  4. Some time later, those resized images should be deleted when we’re sure they’ve been backed up.

With the help of Tasker, an Android app, I was able to do that, and more. Tasker is a tool that lets you automate tasks on your phone. It can do simple things like enable screen rotation when Google Photos or Lightroom are launched. Or it can disable your Wi-Fi if you leave the house.

First, the bad news. The Tasker app costs money, and it’s complicated to use. However, it’s not expensive and there are lots of public Tasker projects on their Taskernet website, which means you probably won’t need to delve into the complexity of it. Much.

Over the course of a few weeks I figured out how to program Tasker to do what I wanted, and if you look at my Taskernet Profile you’ll see the result of that work. The final work on copying the EXIF data took me three hours on the train back from Dublin, and then a hint on Reddit to complete.

The Resize Images for Google Photos Tasker profile does exactly what it says. It moves new photos out of the way, resizes them, and copies the location data to the new files. The original files are moved to Download/jpeg. Finally, it saves the resized images back in a DCIM directory, where Google Photos will find them and upload them.

Every time a photo is taken, it checks if any existing resized photo is more than 7 days old and deletes it, which should be more than enough time for it to be uploaded to Google Photos.

It also moves MP4 files out of the way to Download/jpeg because MP4 files can be huge! You could resize those with Handbrake on your desktop machine before uploading to Google Photos.

Tasker task source code

You install it through Tasker itself or by loading this blog post on your phone. Tap on this Resize Images for Google Photos link, which will bring you to Taskernet. You can also find it by searching for the tags, Files and Camera.

Read the description, and please make a backup of your photos first. Tap Import and Tasker will load. A warning about the commands used now shows.

It does execute Java code, but that’s only to copy the EXIF data to the resized images. It uses shell commands to move files around or delete thumbnails and old files.

When it asks for the profile, just tap on Base, if you don’t have any others. If you are worried about running unknown code on your phone, don’t enable it. Take a look at the “Resize Jpeg Files” task. You can see all 39 lines of code.

Some notes on implementation:

  • The profile monitors the DCIM/Camera directory for new files. If your favourite camera app puts photos somewhere else, they won’t be found.
  • Some paths are hard coded. The ExifInterface library requires a filename. It expects that the Resized directory is in /storage/emulated/0/DCIM/. If it isn’t there, edit line 25. Three shell commands run at the end and use /sdcard/DCIM/. That should be edited too if necessary.
  • Photos are moved to Download/WIP to be resized.
  • After resizing, they are saved to DCIM/Resized.
  • Photos are resized to a maximum width of 1280px, so portrait orientation images will be bigger.
  • Your gallery app will show the resized images as duplicates unless you can hide the Resized directory.
  • The gallery in your camera app is going to show broken images. Your favourite gallery app may not even show the images. I find the Piktures app regenerates the thumbnails properly, but the Samsung and Xiaomi gallery apps don’t. Neither does Google Photos, so if anyone knows how to fix that, I’m all ears!

This might seem like a lot of trouble to save some space in my Google account, but this is something Google could have done themselves. Sure, they have the storage saver setting. That resizes large photos down to 16MP but, even saved in WebP format or something, the files are fairly big. It was an itch I had to fix. Besides all that, Tasker is a very powerful tool that I wanted to use more!

My photos don’t stay on my phone. I use Syncthing to synchronise a few different directories with my desktop machine. Every few days I import them into Lightroom. Importing them moves them, and being removed from the Camera directory is synchronised back to the phone, so the photos are deleted from the phone. From Lightroom they’re backed up in various ways. I actually run a small shell script to move photos taken by various apps into one directory, and check if duplicate DNG/Jpeg files exist, but that’s a topic for another blog post.

Google Photos ends free storage tomorrow

That photo taken today is a helicopter rotor

Google Photos will start counting your uploads against a storage limit from tomorrow. Make sure you upload anything you’ve been meaning to upload in the next few hours!

Also go into your shared albums and click the “Save photos” button if you want “local” copies of any photos shared with you.

I’m sticking with Google Photos. The ease of sharing photos and AI search make it worth while, but I will be disabling automatic upload off my phone. I take too many snapshots that I don’t care enough about to pay for them.

Bye Bye Google Backup & Sync

I’m a huge fan of Google Photos. It’s an amazing service that lets me quickly share photos with particular people, creates interesting images from my photos and it’s a convenient way to bring my photo archive with me on my phone.

Evening in Cork City

However, the new “Backup & Sync” app from Google that replaced the old uploader is problematic.

As well as uploading my photos to Google Photos it would backup to Google Drive. I don’t care about this feature because I use Backblaze for backups. I didn’t really realise what this meant when I first installed the app.

Slieve Liag

I told it to sync my “2018” folder and it dutifully started backing up to Google Photos but I soon noticed that the storage used in my Google account was decreasing. Eventually I found the computers section of Google Drive. All my files were backed up there.

It appears that “Don’t sync to this computer” doesn’t mean “don’t sync this computer to Google Drive”. However it does mean that any files deleted in the synced “Computers” section of Google Drive will be deleted locally. I found this out when I tried to save some storage space by deleting files off Google Drive. Later that day I fired up Lightroom and it reported that a large number of files were unavailable. I opened the folder in Finder only to see the images magically disappear before my eyes.

It was “Backup & Sync” deleting my local files. It was syncing deletes “to this computer”. Thankfully the files were still in the Trash so I could restore them quickly.

Cork City Hall in the fog

So, instead of wasting my storage I need to upload things manually. I see two options:

  • Drag and drop files on to a Google Photos browser window.
  • Sync one temporary folder where I copy duplicates of my photos. I need to periodically delete those files off Google Drive which won’t matter locally because they’ll be duplicates that are deleted immediately after upload.
Grand Parade under construction in 2007

It’s disappointing that Google merged the backup and sync functionality. Google Photos is not a backup service unless you pay for storage and upload full size images. For that reason I can see why they did it.