Sometimes you discover that the images you have made for your game are too small for your purposes. For example, you decide to switch from an old-school 320x200 style to something allowing more details. Or you use sprite rips as placeholders, but the resolution of the rips is lower than you'd like.
There are numerous ways of addressing that, ranging from the standard bicubic filtering found in most image editors and to Genuine Fractals, $160 Photoshop plugin.
There are, however, several lesser-known options.
Well, who am I kidding, most of us used an emulator at least once, so most people already know what filters like 2xSaI or SuperEagle do.
Anyway, here's a bunch of such filters:
- Scale2x - despite what the name suggests, it allows 2x, 3x and 4x scaling. Also it respects alpha, if only 1-bit.
- HQ2x - honest 2x scaling here. Probably the best real-time scaling algorithm there is right now.
- HQ3x - same as the above, only 3x. The page contains the explanation of the algorithm.
- HQ4x - same as the above, only 4x. Just like it's 'smaller brothers', doesn't support alpha.
Here is a sample of Scale2x:
and here's HQ3x:
There's also good old 2xSaI, with SuperEagle bundled with it, but you'll need to compile those manually.
Of course, no algorithm can add detail to your image, but at least the filtered sprites are a good starting point for further tweaking.
Anyway, filters from the list are downloadable as executables, but those only allow processing a single file at a time, which is a pain if you have a lot of files to enlarge.
I made a simple script to automate such tasks.
It takes a name of a filter and a folder name and runs all the images in that folder through the specified filter. It is really dumb, it only processes files of a fitting format (tga for HQ?x, png for scale2x. HQ?x also allows bmp, but only 24bpp, I think, so I only allow tga just to be sure it processes it without errors), and it will processes all such files in a folder. Have some files that don't need enlarging? Move them somewhere else. It also doesn't have any kind of GUI and is purely commandline. Also, it relies on the aforementioned exe files, but it doesn't even check for their presence. It simply passes strings for the shell to execute.
As I said, it takes two parameters: first one is a filter name (scaler2, scaler3, scaler4, hq2x, hq3x or hq4x) and a folder name. If you run it without parameters, it will use scaler2 on the folder you run it from. If you run it with just one parameter it will use it as a filter name, and apply this filter to the current folder.
You should put the filter exes (and all they need to run, namely libpng.dll and zlib.dll for the scalerx) in the same folder as my script. It uses scalerx.exe, not scaler.exe, by the way.
The folder will contain the following:
batchfilter.rb (or batchfilter.exe, if you use the "compiled" version)
Let me say this again: the script does not check if those files are present. You have been warned.
Anyway, without further ado, here's the script:
It is written in Ruby, so you'll need a Ruby interpreter to run it. If downloading 25Mb for a tiny script doesn't sound like fun for you, you can use the exe version:
It's quite large (1.5MB), since it basically contains a Ruby interpreter plus the original script, but it's still smaller than 25Mb, right?
Anyway, I really hope that someone sees merit in it and rewrites it in C or something, so it's not so horribly bloated.