Hands placing pictures in an album

Deploy Photoprism and host your own Google Photos alternative

David Rutland
David Rutland Self-hosted

Google discontinued its free unlimited photo storage tier on June 1st 2021. That blows - for you. For us, it doesn’t matter one bit. Here in at Linux Impact Towers, we moved to an entirely self-hosted solution in 2019, and while it doesn’t have quite nearly as many bells, whistles, and fancy tricks as Google’s offering, it’s better in almost every conceivable way. The chances are that you own an Android device and have a Google account. No, we're not psychic - Android has an 85% share of the global smartphone market and we know about probability.

Like most users, you probably use the default Google Photos app to manage your snapshots, and went with the suggested default settings for sync, backup and storage.

What this has historically meant is that you can take as many pictures as you want and your phone will upload them to Google’s cloud, where they will be stored for your perusal and pleasure in perpetuity. The only caveats being that the quality of the photos is reduced, the originals are lost (unless you choose to keep a local copy), and of course, a corporate monolith gets to snoop in on all your business.

However, after Google's changes the free 15GB storage tier also applied to compressed, reduced quality images as well. You have limited space and it’s running down with every snap you take.

That is, of course, if you don’t pay to upgrade to a tier with more storage.

Or if you host your own solution.

Open-source software steps in where Google fails

Damn straight I am. It’s never a good idea to rely completely on a corporation to look after your best interests - especially if that corporation is doing it for free*. Terms and conditions change, and you really have to consider what’s in it for them. Hosting a 15GB photo archive with triple backups is expensive. The old canard about you being the product is true.

Did we mention that Google will also start deleting your stuff if you don’t use the relevant service for two years? No? Well, it will.

Fortunately for you, there are low-cost ways or even free (depending on what hardware you have lying around) ways of avoiding Google altogether when it comes to syncing your photos to cloud services - and best of all they can be entirely under your control, based on Free and Open Source Software.

NextCloud Photos isn't yet good enough

We love Nextcloud - it’s a one stop Google Drive / Dropbox replacement which runs on your own hardware, and can be expanded with apps which increase its functionality.

Our favourites include Nextcloud Talk, which is a video conferencing platform; Cookbook, a fantastic recipe manager; Notes (a notes application); and Social, a basic Fediverse interface. As of October 2020, it even has a functional, ARM64 compatible fully featured office suite - although it is currently to laggy for everyday use.

At home, we host Nextcloud on an 8GB Raspberry Pi, We’ve previously had it running pretty sweet on a 4GB Pi and a 2GB Pi. What can we say? We're attracted to new and shiny things. We documented our first steps in this direction over at cyberpunks.com, and to avoid repeating ourselves, we won’t repeat the content here.

Unfortunately its photo organising software sucks balls compared to literally anything else. While the gallery app was at least tolerable if image preview generation was correctly configured, the new Photos app is simply atrocious to the point of being unusable.

But that’s fine, we’ve left Nextcloud to handle uploading and synchronising photos across our devices - something it excels at, but it isn’t the only software we have deployed on our Pi, and depending on your use case, you may find some more suitable than others.

Keep your photos safe

With Nextcloud handling sync and upload and dumping photos from various users into the various associated directories on the Pi’s 128GB SD card, how do I access and display them.

First up, I’m not happy with keeping everything on an SD card. They’re prone to failure, so everything will be lost if not backed up. Google backs up your photos onto three physically separate servers. I use a 4TB SSD attached to the Pi, and a gZipped disk image on another machine. If you’re taking control of your own data, you have to take care not to lose it, and if you’re using a Pi for this, then at the very minimum, we would suggest having photos stored both on the SD and an SSD.

Photoprism is the best self-hosted photo gallery available

Photoprism is a work in progress, but at the time of writing, it is, in our opinion, the best self-hosted FOSS photo organiser and gallery out there. Sure it, still needs some work, but that work is underway and it gets better with each iteration.

The default interface looks like this:

photoprism default view

Not too shabby, eh? You’ll note that all of the pictures appear to be of dogs or are, at least, dog-related. This is because Photoprism leverages Google’s excellent TensorFlow library to do some basic object recognition. I can type the word ‘dog’ into the search bar and it will bring up pictures of dogs. Photoprism classifies the images automatically based on content, as well as by what it extracts from EXIF.

If you want, you can browse by location-taken on a nifty world map, filter by the type of camera used, colours, months and years.

It is also fast. Far faster to use than any of the other FOSS alternatives we’ve tried.

So, How do you add your photos to Photoprism?

We’ll assume that you’ve downloaded your multi-gigabyte archive from Google and have it stored locally ready to go. In the Photoprism Docker compose yaml file, you can specify a directory for imports. Dump them in there and the software will automagically import them, classify them and tag them. Depending on jut how many pics you have. This could take a long time. For our 12GB archive, it took the better part of a day. Copies are made and saved to a directory which Photoprism calls ‘originals’.

Going forwards, you’ll be syncing photos on your phone with Nextcloud, and it is a doddle to link Photoprism to your Nextcloud accounts and sync on an hourly or daily basis. Again, new pictures detected will be copied and imported by Photoprism, and added to your gallery. If your Nextcloud data directory and Photoprism originals folder are on different physical discs, this simplifies the backup process immensely.

If photos you know you’ve taken don’t appear in the gallery - it might be that Photoprism thinks you’re a crap photographer. Poor quality snaps need to be reviewed manually before they’ll appear, although if you don’t feel that software should be the arbiter of your art, you can change this behaviour in settings.

Likewise, if there are snaps you don’t want to see - you can banish them to the archive. You’ll still be able to find them if you make an effort, but they won’t appear in the default view

There are Photoprism apps available for Android and iOS - although not through the official stores, so you will need to sideload them. On Ubuntu touch, it can be accessed easily through a webapp.

I can’t overstate how simple and quick it is once the software is up and running. After using it for a while, it becomes natural. No, it’s not Google photos, but In our opinion, that’s a good thing.

Getting Photoprism up and running

I’m going to be talking about the Raspberry Pi 4B here, because that’s what I use. However, Photoprism will run on pretty much any Linux system. The Raspberry Pi instructions are here and are easy to follow - the only thing you need to ensure is that the Pi is running the 64 bit kernel. If you’re on default Raspbian, you can enable this by adding arm_64bit=1 in the Pi4 section. Also, if you have the 2GB variant of the Pi, you will need increase the swap file by at least 2GB, so the memory isn’t maxed out when indexing.

Other contenders

The Awesome Self-Hosted repository on Github lists a couple of dozen self-hostable image and video galleries. Some we rejected out of hand because they were either proprietary software, or their description didn’t quite seem to fit our needs, or for the very simple reason that they aren’t ARM compatible and therefore won’t run on the Pi.

Of those which remained, here are their main selling points and sticking points.

Lychee.

Beautiful and organises pictures into galleries. Easy install. No Nextcloud integration.

OwnPhotos

Self hosted wannabe Google Photos clone, with a slight focus on cool graphs - probably the closest to Google Photos. Unfinished, unstable, and abandoned.

PiGallery2

Fast, beautiful, and designed for the Pi. Does not copy photos to its own directories. Copes poorly with large photo collections.


So there you have it.

If you fancy giving Photoprism a go without actually running it yourself, hop on over to the demo server.