Skip to main content

Adjusting the dominant colour of an image

A week ago, I was at a “book dash” (a collaborative writing event) for the Turing Way, a book about reproducible data science. As part of the day, we had an illustrator from Scriberia creating some drawings for the book. You can get an idea of what the illustrations look like by browsing the images from a previous book dash, which are published under a CC BY license.

One of my favourite images from that set is one titled “readable code”, which shows an explorer trying to read hieroglyphs that represent unreadable, confusing code:

A person holding a torch peers at a wall inscribed with code. Above their head they're thinking “What the??”
Created by Scriberia for The Turing Way community; used under a CC-BY licence.

Like the other Scriberia illustrations in that collection, it’s black and white with a single accent colour – in this case, a pinky-purple.

If you’ve ever seen my talks or my selfies, you’ll know I like to match colours – maybe my slides will be green to match my outfit, or blue to match the conference theme, or I’ll wear red to match seats on a train.

Suppose I wanted to use this image in a slide deck: I’d want it to match the colour scheme on the other slides. This image would work equally well with plenty of other accent colours, so how do I change it if I want something different?

I’ve been adjusting the colours of images like this for a while. A couple of people saw me doing it on Thursday, and asked me how, so here’s my technique:

With these two tools, I can get an image in a range of different colours:

A selection of readable code images, in a different range of colours.

Using the hue adjustment means I can find something in the right ballpark to match the rest of my slides. I might also tweak the saturation/brightness in an image editor if the shade isn’t quite right – and then I have an image to use in my slide deck.

You can see another example of this technique in the slides for my curb cut effect talk. There’s a picture of a handle on a purple door, but the original image had a red door. Without a side-by-side comparison, you’d never realise the image had been changed:

A metal door handle on a purple door A metal door handle on a red door
modified image original image

It’s a small detail, but I always enjoy making my slides match this way.