• they/them

21 yr old nonbinary art student and certified little guy ✨



torcado
@torcado

torcado.com/cleanEdge

hi friends,
i recently posted about clean4x, a pixel art upscaler i made. it was mostly a proof of concept, i never expected the amount of attention it got!

i've spent my time since then significantly improving on the algorithm, and i'm extremely happy with the results.
i'd like to share cleanEdge:

https://torcado.com/cleanEdge/

and this time, i made a tool for it! you can use it! drop or paste any sprite into the editor and compare the results to normal, and even download rotated or scaled versions of your sprite!

i've open-sourced both this version and the previous under the MIT license, you are free to do what you want with it :) the source code for cleanEdge can be found here

more details under the cut:


this improvement requires a whole new name and version because it scales infinitely, to any arbitrary size, whereas the old clean4x was strictly a 4 times scale.
the results of rotation with clean4x looked ok, but this new method blows it out of the water in my opinion. i really can't believe how well this works, and i hope it's clear to see.

the idea with this system is to approximate the best-case source image, what someone might draw if they needed the most data present for a rotation to use, i.e. a vector image. in the most basic case, a pixel artist drawing a 1-pixel thick diagonal line is representing what would really be a solid 1-pixel thick line
1 pixel thick line conversion

and in fact, if you have an exactly 1-pixel thick vector line and rotate it, it's guaranteed to never produce any gaps when rasterized to nearest neighbor! this was the original idea i had many years ago.
so, cleanEdge tries to make lines and edges as close to solid 1-pixel thick lines, by expanding those regions into neighboring pixels (and vice versa)

methodology-wise, the algorithms are largely the same, each pixel checks its neighbors and determines where and how to fill colors. and as with the old version, this new one guarantees the image produces identical results when rasterized with no rotation. but this new version doesn't just stop at "subdividing" pixels to 4 segments, it goes arbitrarily deep. this ends up working out very well with regards to final rasterization when rotating, essentially preventing any gaps in lines or edges (at least, those that are 1:1 or 2:1 diagonal, but that tends to make up the majority)

as explained on the page, i took care to make the results just from scaling look good (requiring a lot of edge case cleanup), but these details have no effect when just using the algorithm for rotation. to be honest, i'm not entirely happy with the upscaling results alone. it's significantly higher resolution than the old one, and while that's an improvement in some sense, it also results in a lot of weird looking cases (unless you disable slopes and set the line width to 0.707, those results are basically perfect. otherwise, there has to be some sort of priority bias, and catching every possible edge case is both difficult and performance intensive). but for rotation, i'm very happy with it.

i hope you find this tool useful in one way or another. thanks for all the support :)


You must log in to comment.

in reply to @torcado's post: