Search code examples
algorithmbitmapscaling

Is there a known bitmap scaling algorithm that produces the same result as this algorithm?


My algorithm for scaling a bitmap b of size w1 × h1 to a bitmap of size w2 × h2:

  1. scale b to a bitmap b1 of size lcm(w1, w2) × lcm(h1, h2) using nearest-neighbor scaling algorithm;
  2. partition b1 to a grid that have w2 columns and h2 rows where all columns have the same width and all rows have the same height;
  3. set the color of every pixel in b1 to the average color of the pixel's belonging grid cell;
  4. scale the modified b1 to a bitmap b2 of size w2 × h2 using nearest-neighbor scaling algorithm;
  5. The bitmap b2 is the result of this algorithm.

The algorithm above is not the most efficient one to get the result. I only use it to describe the effect of the scaling algorithm (and I can do it in Photoshop instead of writing a program). Is there a known algorithm that produces the same result as mine?


Solution

  • I found a detailed description here: http://entropymine.com/imageworsener/pixelmixing/.

    It’s sometimes called pixel mixing, pixel averaging, or area map, among other things.