Why are images still a pain? They seem like that to me. Getting a good image from one place to another seems more complicated than it needs to be. Ever since flickr changed hands I’ve been wondering how to deal with all the different images I generate and consume. To be fair, even when flickr was the one decent thing yahoo owned, I still had issues organising things. Add to that the subscription model that adobe now uses and I figured I needed to devote some serious time to sorting out my image processing and sharing.
We live in the age of the image, according to this BBC program. I’d say mobile phones are responsible for the vast majority of images out there on the internet. Of course, there are memes, diagrams, clipart and many other images generated from things that aren’t phones — can’t forget these of course — but even my own phone has started to supplant my DSLRs. Regardless the sources of images have multiplied exponentially.
But so too, have the ways that we share images. No-one wants to go through the holiday photo slide show anymore — hell, if it’s not live and online immediately it’s probably too late (I exaggerate a little). The demand side of the equation has also changed.
Enter me, with my phone, micro 4/3rds, 360 camera and a whole load of miscellaneous webcams, science images, diagrams and more. How can I make this easy and fun? This is the first part of what will no doubt be a few posts on how I fix this thing (at least for me). Hopefully, it might inspire some of you along the way.
I like photography! I’ve done a fair bit in my time on a variety of different cameras. I take a lot of photos on my phone too. I generate a lot of images through the work I do, from screenshots to 3D renders and everything in between. Photos from my camera start off in one of a variety of RAW formats. Sometimes, multiple exposures are combined through various HDR softwares. Sometimes I’ll need to use the GIMP to crop things, or imagemagick for resizing. In short, there are many sources for my images, often with different processing pipelines. They all need to be backed up and available for use.
Many of my photos end up on this blog, which means they need to be hosted online. Sometimes I just want to send an image to someone on Signal. Maybe, I’m in a pub (well, not at the time of writing obviously!) and I want to show someone an image there and then. What about posting on instagram (somewhat problematic for a few reasons), or medium? Just like the supply side, there are many moving parts on the demand side we need to consider too.
The supply side
Let’s start with the supply side. These days, I tend to shoot on a Panasonic Lumix DMC-GX8 for the most part. My Fairphone 2 does a bit of lifting too but we’ll come back to that later. How can I deal with the RAW files that come off my Lumix? Well, I’ve found two programs that have really helped — Digikam and Rawtherepee.
Digikam does a good job of organising everything. It understands the notion of local and remote storage. My server now holds all my images, backed up using ZFS RAID. I can still search through and preview these images pretty quickly on any other machine with Digikam installed. One could just use some sort of directory browser and be super careful about convention — indeed this is what I used to do — but having some metadata and the subsequent search capability is very handy. Digikam works on both Linux and Windows — the two operating systems I use.
I found that while Digikam’s editing capabilities were fine, Rawtherepee does an even better job. I now can’t live without the de-haze filter! I the past I tried to use darktable, but I found it’s photo organising system to be inferior to Digikam’s when using remote storage (it may have changed since then) and the actual image editing was a bit clunky — I’d been using Lightroom for quite a while at this point. Rawtherepee has many features I’ve yet to try, but so far I’m really happy with the results.
The bit in the middle
From the outset, it seems we will need some sort of online storage of processed images, ready to be sent to where they need to go. I used to use the aforementioned flickr for this, as their API was pretty good. I decided I would set out to host my own version of someting like flickr.
At first, I looked at pixelfed — one of the many ‘fed software packages out there. Mastodon and Peertube(warning! Maybe NSFW!) are perhaps more well known examples of the fediverse. The problem is I don’t think pixelfed is ready for being self hosted. I had a terrible time trying to get it to run on my server. That was a real shame as I’d like to get involved with the fediverse a little more. Maybe in the future I’ll give it another go.
For now though, I thought I’d go with something more simple. I’d written an image based website for a client in the past, so I went back to that code for some inspiration. Most of the parts I needed were already there. I decided to start a new project I would call Shutr (because of course I would!).
At it’s heart, Shutr is a flask programming, running with uwsgi, on an nginx server. I wanted some image categories, titles and descriptions, different sizes of images and some security around the administration. Flask on it’s own takes care of some of that, but I’d need a few extra libraries to do the heavier lifting.
Pillow is almost the de-facto for image processing with python these days. For my purposes, it would do the resizing of uploaded images reasonably enough, along with conversion to jpg or png format.
In the past, I’d written my own database middleware for talking to SQLite(yes I know, I’ll move to postgresql eventually!) but recently I’ve discovered SQLAlchemy and flask-sqlalchemy. I wish I’d have known about this sooner — it takes away a lot of the grind. Definitely recommended!
and the demand side?
I’ve been thinking a lot about how we share photos these days. In the before-plague times, I noticed folks would share photos by showing one using their phone. WhatsApp, Signal, Instagram and a whole host of other mobile applications exist for sharing photos when you aren’t in close physical proximity to someone. It seems to me that the phone is king.
Synchronising to and from the phone should be fairly easy with a REST based setup. No doubt it will involve some Kotlin and a little Android Dev but hopefully that won’t be too hard.
In our front room, we have an over-the-top picture frame, built with a RaspberryPI (a really old one). I built this ages ago but it has recently been resurrected. It loads images by grabbing the URLS via a REST GET request. Using pygame, it then goes full screen and displays the images. One of the things I found most tricky was getting something to automatically start on Raspbian and not have the screensaver barge in. Thankfully, I found the answer:
# Ping until we damn well get a connection((rc = 666))
while [[ $rc -ne 0 ]] ; do
ping -c 1 184.108.40.206 2>&1 >/dev/null # Try once.
if [[ $rc -eq 0 ]] ; then
((count = 1))
((count = count - 1)) # So we don't go forever.
doneif [[ $rc -eq 0 ]] ; then # Make final determination.
echo "say The internet is back up."
echo "say Timeout."
ficd /home/pi/ClassyPi && python3 sync.py
cd /home/pi/ClassyPi && python3 classypi.py /home/pi/ClassyPi/settings.txt &
This cheeky little bash script checks for an internet connection as I noticed the Pi would take a while to find one sometimes. The trick was figuring out how to get this script to start.
The Pi uses the LXDE window manager, which does have some functionality for this. One needs to add or modify the autostart file:
…adding the line
@lxterminal -e "/home/pi/myscript.sh"
That should do the trick!
There’s a lot more to the demand side. Twitter-bots, IRC links, Blog posts (like this one), URL shortening and no doubt many other ways these images can get out there. I’ll no doubt talk about it here as I code up more stuff.
It’s early days yet! I need to add some more features such as multiple categories, pagination in the admin area and maybe even a little search functionality to shutr. I’ll need a small program to do batch uploads to shutr. I’m not sure if this will be a standalone program or a plugin for rawtherepee (digikam has some upload functionality but I’m not sure if either allow for user plugins). I’d like to be able to right click on an image (in Linux to begin with) and have a dialog pop up saying which category it should go in and then upload it. It should all be do-able — it just needs a little time.
Who’d have though images were still such a pain to organise, sort and use? Maybe I care a little too much about them? Maybe other folks just shoot, send and then forget — their phone being the only device they use? Still, at least I can see a solution and it’s in my grasp!