0

Nearest-neighbor is a commonly-used "filtering" technique for scaling pixel art while showing individual pixels. However, it doesn't work well for scaling with non-integral factors. I had an idea for a modification that works well for non-integral factors significantly larger than the original size.

Nearest-neighbor: For each output pixel, sample the original image at one location.

Linear: For each output pixel, construct a gradient between the two input pixels, and sample the gradient.

Instead, I want to calculate which portion of the original image would map to the output pixel rectangle, then calculate the average color within that region by blending the input pixels according to their coverage of the mapped rectangle.

This algorithm would produce the same results as supersampling with an infinite number of samples. It is not the same as linear filtering, as it does not produce gradients, only blended pixels on the input-pixel boundaries of the output image.

A better description of the algorithm is at this link: What is the best image downscaling algorithm (quality-wise)? . Note that the URL mentions downscaling, which could potentially have more than four pixels per output pixel. Upscaling has a maximum of four input pixels per output pixel processed, though.

Now is there any image editor or utility that supports weighted-average scaling?

nyanpasu64
  • 2,805
  • 2
  • 23
  • 31
  • So what exactly are you asking? – 500 - Internal Server Error Apr 21 '14 at 23:58
  • 1
    Have a look at http://stackoverflow.com/questions/12526449/what-is-the-name-of-this-algorithm-and-how-does-it-compare-to-other-image-resam – Mark Ransom Apr 22 '14 at 00:54
  • Yes, that is a correct description of the algorithm. What sucks is that it's not popular, there's no standard name, and it is not implemented in any photo editors that I know. It's a shame, it's the best retro-looking pixel art scaling algorithm I know of, not including blurry feces ((bi)/cubic/linear filters), and scalex/hqx/xbr(z), which do not preserve pixellation. Maybe I should write my own little programlet, like I did for xbrz/reverse-AA. – nyanpasu64 Apr 22 '14 at 03:20
  • It is call Fant in [Microsoft literature](http://msdn.microsoft.com/en-us/library/windows/desktop/ee719810(v=vs.85).aspx), and CV_INTER_AREA (area relation) in [OpenCV](http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#resize). – rwong Apr 22 '14 at 04:37
  • Is there any image editor or utility that supports it? – nyanpasu64 Apr 22 '14 at 17:51

0 Answers0