Recolouring Images With a Colormatrix

I fell in love with this wallpaper ("Sunny Stag” by Robert Farkas) the moment I saw it:

Sunny Stag by Robert Farkas

However I prefer dark themes and darker-coloured wallpapers, the original was a bit too bright for me. One Reddit user had made some inverted versions but I wanted a similar-coloured stag on a dark background (i.e. the colours should stay mostly the same). I use NegativeScreen all the time to darken my screens because it has “smart inversion” modes, which mostly preserve colours while still making things darker.

I had a look in its config file and noticed each inversion mode uses a “colour matrix”, so I did a little Googling and came across the MS docs for using the ColorMatrix class to recolour an image. All I really had to do was change the matrix to the “smart inversion” matrix from NegativeScreen’s config, and save the resulting image. Here’s the code for it:

And I think the resulting image looks pretty nice!

Sunny Stag by Robert Farkas (Full-size version)