Creating desktop wallpapers from photo albums

Posted by Angus Doherty on November 07, 2020 · 2 mins read

When travelling, I enjoy taking photos. I don't have the most photographic memory, so it really helps me to revisit some of my best memories. This has led to a large album of my favourite travel photos hidden in the depths of my hard drive; rarely looked at.

Due to the COVID-19 travel ban, revisiting these memories has become much more important; my travel bug is constantly itching! Using my favourites album as desktop wallpapers helps scratch that itch, being greeted by a different memory every time I log on to my PC.

Perfect; Windows has a wallpaper slideshow option that allows you to rotate through an album with a specified frequency. However, the image fit options are less than ideal:

Fill, Centre, Stretch, Tile, Span and Fit.

Occasionally an option suits, but as image dimensions vary it's rarely one size fits all. This leads to cropped or stretched images; not great!

The final option, fit, offers the best middle ground, leaving the photo itself unaltered, but adding large black bars around the perimeter of the image. We can do better than this!

Blurpapers

To solve this, I wrote a couple of functions in Python, which aim to improve the appearance of centred photo wallpapers. It uses OpenCV to reshape an image to the size of your primary monitor, then add a Gaussian blur filter, and overlay this with the original, centered image. This process removes the black bars, replacing them with colours that are more easy on the eye. It adds blur horizontally or vertically around the centered image, depending on its aspect ratio.

You can find the Blurpapers repo on Github here.

I think the after images look much better. Let me know in the comments if you have any success using the code yourself, or if you have any feedback!

Before - 3:4 image

After - 3:4 image

Before - 16:9 image

After - 16:9 image

Before - 4:3 image

After - 4:3 image