I decided to get HQX to compile on Win64, so it can be used by sprites. The author didn’t reply to my email, so I just decided to hack it up. It’s open source, after all.

It wasn’t too bad, just a bunch of random tweaks to get it to compile using visual studio instead of MinGW. So, since there was already some code sitting around for the Scale2X algorithm, I took a few screenshots to see how they compare with Nearest Neighbor scaling.

Nearest Neighbor

Nearest Neighbor

Scale2X

Scale2X

HQX

HQX

I can’t really decide which I prefer. Nearest Neighbor always looks a bit too jagged for my tastes, but some sprites don’t look right with HQX. Scale2x does a good job retaining the classic look, but it’s not without artifacts.

There were a few researchers at Microsoft who wrote a paper on a really cool scaling algorithm, called Depixelizing Pixel Art. The sad part is, they didn’t release any source code or a library. So it’s pretty much just something to look at and say “Oh. That’s nice. Too bad none of us can actually use it” ..

I’d love to give their algorithm a shot to see how it stacks up against the others. I honestly don’t know what the point is to create an elaborate algorithm and presentation, then do nothing with it. Maybe it has some use case at Microsoft, I suppose.

So, which do you prefer? Do you have a favorite scaling method outside of these 3?

9 thoughts on “Pixel Scaling (Nearest Neighbor, Scale2X, HQX)

  1. I have an incomplete implementation of the “Depixelizing Pixel Art” algorithm on github. It currently does everything except the final smoothing step (which is buggy) for any image that doesn’t have open-ended curves (which is anything monochrome and some multicolour images).

    It’s a personal side project that I don’t have the time to work at the moment, but I’m happy to discuss it or accept pull requests if anyone wants to continue from where I left off.

    Like

    1. That’s awesome. Is there any way to interface with it in C/C++? If not at API level, even just a command line would work, as GDI+ can easily read/write png files.

      Like

  2. It’s all Python code, but there’s a command line tool that reads PNGs and writes SVGs.

    It probably isn’t suitable for you to use as-is, unfortunately, but you’re welcome to hack on it if you want.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s