Jump to content

"Nearest Neighbor" scaling in Resize Image vs. Drag Selection is buggy


Recommended Posts

I would like to report an apparent glitch with the Resize Image "Nearest Neighbor" algorithm when downscaling.
 
 
As you can see in this image, the sprite I am downscaling is symmetrical, though I have no doubt this could affect the downscaling of nonsymmetrical sprites as well. When I downscaled the sprite (shown here rescaled for detail) from 14x16 to 12x16, it lost its symmetricality, which seems like a glitch. Oddly enough, the apparently different Nearest Neighbor algorithm used for scaling selections does not have this glitch.
 
If this behavior is not intended and you need more examples, I will be happy to help as I use Paint.NET for pixel art all the time.
Link to comment
Share on other sites

If you can make a video to show this, that would help a lot.

 

You won't necessarily get the same results with Image->Resize vs. Move Selected Pixels if what you're selecting and transforming is not the entire image.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

5 hours ago, Rick Brewster said:

If you can make a video to show this, that would help a lot.

 

You won't necessarily get the same results with Image->Resize vs. Move Selected Pixels if what you're selecting and transforming is not the entire image.

Here you go:

 

Link to comment
Share on other sites

18 minutes ago, Rick Brewster said:

Can you also attach the image that you're using?

Here you go. This image is horizontally symmetric, so that's how I could tell that if the downscaled image to 12 pixels wide, which is a multiple of two like 14 is, was not symmetric then that seemed like an issue.

sluggula3.png

Link to comment
Share on other sites

I love puzzles and this thread has one indeed!

I tested the effects on symmetry of the icon by using horizontal pixel reduction using the resize feature of PDN.
I three cases using the resize feature on the image; from 14 x 16 px to 12 x 16 px; resulted in the destruction of veritical bi-lateral symmetry.

I resized by using Nearest Neighbor, Bilinear, and Bicubic Interpolation and got the same result.

When I resized the icon by dragging across two pixels inward along its vertical axis; bi-lateral symmetry was maintained but the color count increased from 8 colors to 75 colors.

 

Edited by HyReZ
Correcting spelling and adding more nfo!


 

Link to comment
Share on other sites

  • 2 weeks later...

By the way, here is another example image (the left one is 32x32px). It is horizontally and vertically symmetrical (one quadrant mirrored for the other three). It is another sprite from Link to the Past before anyone accuses me of not giving credit :P

In1hRVQ.png

You can see that resizing it to 50% ruins the symmetrical nature of it. Interestingly, I realized through tests, that if I resize it to 15x15, it looks resized great. It is perfectly symmetrical, well that is if you add in the top row and left column of pixels yourself, but still looks much better. I hope that this is helpful to narrowing down the problem.

@Rick Brewster

Link to comment
Share on other sites

I just spent some time investigating this, and I'm not actually convinced that there is a problem/bug here. Subjectively, yes it certainly doesn't work well for your scenario.

 

However, nearest neighbor resampling doesn't give any promises about symmetry. In fact, it explicitly doesn't, and it can't.

 

Take the following sample image, where I've drawn a symmetrical, aliased, filled circle and then added red dots to every other pixel:

 

image.png

 

The red dots are the pixels you'd expect to be picked up when using nearest neighbor resampling and reducing the image from 16x16 to 8x8 (a 50% reduction). In fact, these aren't the pixels that are actually used -- if you take the red dot layer and shift it down-and-right by 1 pixel, then those are the pixels that get picked up. But, the result is the same: you are picking up pixels that are not distributed symmetrically. They are distributed evenly.

 

You can, of course, craft up a resizer that does do things symmetrically. However, it will only be symmetric for some cases, not all. You as the artist are just going to have to be intentional about this kind of resizing: which rows and columns can you remove and still retain your desired result? That's an answer that the human brain is currently better at doing on a case-by-case basis.

 

The fact that Image->Resize and Move Selected Pixels produce different output is unfortunate, but may also just be "a math thing". In fact, MSP produces different output if the image is resized from the left edge vs. the right edge :) 

 

Image attached so you can play with it yourself.

 

circle16x16.pdn.zip

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...