caustik's blog

programming and music

Pixel Scaling (Nearest Neighbor, Scale2X, HQX)

with 9 comments

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





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?

Written by caustik

April 17th, 2012 at 12:37 am

9 Responses to 'Pixel Scaling (Nearest Neighbor, Scale2X, HQX)'

Subscribe to comments with RSS or TrackBack to '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.


    17 Apr 12 at 11:03 am

  2. 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.


    17 Apr 12 at 4:15 pm

  3. 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.


    18 Apr 12 at 4:14 pm

  4. Klimax

    18 Apr 12 at 4:32 pm

  5. hmm cool, thanks


    18 Apr 12 at 8:44 pm

  6. This is a indeed cool algorithm. Do you have a implmention for Depixelizing Pixel Art now with C/C++? Thanks.


    22 Aug 12 at 2:37 am

  7. I sent an email to Kopf, about a year ago – he said that he was considering releasing an executable. It doesn’t seem he has, yet 🙁


    22 Aug 12 at 5:27 am

  8. I would like to implement this algorithm and develop an app base on it, do I need to pay for any money if I use this algorithm on my app?Thanks


    9 Dec 12 at 6:02 am

  9. Check this out . It is an alternative to enlarge the pictures.


    4 Jan 13 at 7:52 am

Leave a Reply