Nearest neighbour resampling mode for the Transform Tool

Greetings all.

A small request that can make Pencil2D better at pixel art.

Give us an option for nearest neighbour resampling in the transform tool.

We already have the ability to draw nice pixellated lines with the pen tool and pixellated lines work great with the fill tool. If we could use the transform tool’s rotation and scale while preserving the pixel effect, it would be awesome.

I saw that a few months ago someone here asked for rotation without anti-aliasing. That thread is locked. It didn’t seem to get any attention.

There are other dedicated pixel art and animation programs out there but none of them has the audio layer support Pencil 2D has.

Thank you.

This has been requested several times and we are aware of the desire from some of our users for this feature. It will likely be added to Pencil2D at some point, but I cannot offer a timeline for implementation.

However, rotating with the nearest neighbour algorithm will likely not have the desired effect for your pixel art. Here is a post I made a while ago on our Discord server which demonstrates quite well that just because you’re not using an interpolation method that blends pixels, that is not a magic fix for image degradation. Unless you’re rotating in 90 degree increments, you’ll always be trying to fit diamonds into square holes.

The nearest neighbor algorithm is quite bad at handling rotations, and won’t work the way you imagine it working, particularly with multiple rotations.

Consider this graphic. In the top row, a pixel art image is rotated in 15 degree increments without interpolation. Yes it keeps your colors, but it also very quickly destroys the image. Even when you rotate from the original source each time without interpolation (the bottom row), the results are often not acceptable for pixel art.

As you can see, just a single rotation can produce pixel art that does not look right, and a few rotations will completely ruin your image. At large scales, this effect will be less noticeable, but it will still degrade the quality of your images, especially along hard transitions.

For this reason a lot of pixelart software apply upscaling to the input image first, rotate and then scale it down again.

The most known algorithm is called RotSprite

This has very specific usage though, as such it’s not something I personally would want to implement in Pencil2D.

As an animator who has only done a handful of bitmapped animation projects, I haven’t noticed the problem.

Most of my animations, including those produced with Pencil2D have used vector drawing.

Can I suggest a solution. Draw the drawings that you envisage, or have found to be problematic, using a vector package, like Inkscape. Rotate these as required, then export the images as .PNG files for importing into Pencil2D.

I know. The dirty, destructive transformation is better than nothing. Also one or two transformations isn’t going to degrade it that much.

Also I am not trying to do pixel art for games although I said pixel art earlier. It was for the sake of brevity. I actually was thinking of animated videos but with the low res aliased look. This would be great for anyone who wants to use a dirty style but with ease of filling with colors.

If you can implement the algorithm mentioned by the other person that would be great but I don’t think it’s an important feature for Pencil 2D. But the raw nearest neighbour sampling isn’t too much work I hope.

Thank you.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.