How to recolour your boss to reappear as a character in a Visual Novel


It's a common trope in video games. You just defeated the monstrous Scarlet Dragon only to then see a bunch of green-coloured versions of it in the next region. Well, as fate would have it, I used exactly that technique to create my boss… I mean, the love interest of the cats!

Warning: here be mermaids

Okay, so first off, the truth is, that it's not so difficult to just recolour one sprite. However, for the purposes of Hot Spring Mermaid, I had to recolour the same sprite in different poses over and over again. So, how did I do it? Why, with Makefiles of course!

Okay, first things first. Before we can start writing Makefiles, we need to establish a set of operations, that we wish to perform on our image to make a recolour. Here we can simply use an image manipulation program of our choice and define some filters. Easy peasy. But wait, we just changed one sprite. What about the other ones?

Well, what's important here, is that we first memorise this set of steps, because we are going to need them shortly. But rather than repeating them over and over again, we will only repeat them once more. Before that, however, we have to create the image to repeat them onto. Let's cast some ImageMagick!

convert hald:8 colours.png

This creates a colour lookup table (a "fairly large" one at 512x512, even, but you can use other numbers instead of 8 if you want). Now let's create two directories: an in directory, in which we'll store our input and an out directory for our output. Finally, we create a Makefile with the following rule:

out/%.png: in/%.png
    convert "$<" colours.png -hald-clut "$@"

Now, if we type make out/something.png, the file something.png is copied from in to out. Wait a minute, that's not useful at all! What did we waste all this time for?

Remember the set of operations from earlier? No? Okay, try to recreate them in your head and then apply them to colours.png. Now if you make out/something.png (perhaps adding --always-make or -B, given that we already have that file and its input didn't change), you'll actually see the colours being changed. With that you only need a make target depending on all out/%.png you wish to create and you're done.

Of course, there are some improvements you can make. For instance, you could add colours.png as a dependency to the make rule or even use another build system altogether, but assuming that your colours stay the same and only the other inputs change over time, that rule should suffice.

For the record, I used the following for Aya. You can reuse it under the terms of the WTFPL.


Get I've met a Mermaid in an Onsen

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.