0

A pixel art image originally has a consistent resolution with its grid size. However, in our case, this image may be upscaled using nearest neighbor upscaling to an arbitrary size (like 16x16 to 200x200), eg, a grid may contain 10 pixels. Our goal is to retain the original grid size of this image, ie, the exact number of grids.

Is there any way to do this? This seems to be a simple image processing problem, but I cannot figure out an effective solution. A fact of nearest neighbor upscaled pixel art is that the color distribution remains the same.

Thanks for your help.

SF.H
  • 1

1 Answers1

0

Well, the way I see it, there are essentially two cases :

  • Case 1: The up-scale is a mutiple of the down scale : $(N \times M) = (a n \times b m)$. Then, the problem is more or less trivial.
  • Case 2: The above relationship does not hold, and using antialiasing techniques will help restore a feeling of sharpness in the image.
G. Fougeron
  • 1,544
  • Thanks for the comment. But is there any way that I can get an exact number of grids? – SF.H Jun 10 '21 at 07:56
  • what do you mean "an exact number of grids" – G. Fougeron Jun 10 '21 at 07:58
  • If a pixel art image is originally 16x16, then it is upsampled to 200x200. How can I get the original size based on the 200x200 image only? And the 200x200 has the same distribution as the original 16x16 image because of the nearest neighbor upsampling. – SF.H Jun 10 '21 at 08:02
  • Ah. This was absolutely not clear from your question. My best guess : do a 2D Fourier transform of the image and inspect the spectrum. There should be a clear spike at the desired frequency. – G. Fougeron Jun 10 '21 at 08:07
  • Dealing it in the frequency domain is a very wise suggestion! Thanks, I will try it out! – SF.H Jun 10 '21 at 08:08