# How do screens smoothly scale resolutions that aren’t multiples of each other? E.g. playing 1080p or 720p video on a 900p screen, or reducing my phone’s resolution from 1440p to 1080p?

211 views
0

How do screens smoothly scale resolutions that aren’t multiples of each other? E.g. playing 1080p or 720p video on a 900p screen, or reducing my phone’s resolution from 1440p to 1080p?

In: Technology

There are complex algorithms that will combine pixels with their neighbors in certain ways. If you have a higher resolution screen being scaled down such that a pixel should be 70% one color and 30% a different color, the calculation would yield a combined color of the appropriate proportions.

There are formulas, and basic version is fairly simple.

You know coordinates of the pixel, and its color. Coordinates are numbers, color is also numbers: three numbers per pixel, i.e. the intensity of Reg, Green and Blue.

You can make a math function mapping any coordinate to color:
https://wiki.tum.de/display/lfdv/Super-Resolution#Super-Resolution-ClassicalApproaches
Then you put a new grid of new pixels over that image, and read the color at each new pixel.

Or a really simple example. You want to display 720 image on a 1080 screen.
Note that 720/1080 = 2/3.

Take first pixel from 720 image. It is the corner, so we make first pixel of 1080 screen the same color. Let’s assume that color is completely black (0% white).

The next pixel in 720 is 100% white. It is 1/720 to the other end of the screen.
The next pixel in 1080 is 1/1080 to the other end of thescreen, i.e. it is between first and second pixel of 720 image. But it is also closer to to the second pixel: 1/1080 = 1/720 * (0.6667) + 0*0.3333.
1/720 and 0 are positions of first and second pixels, and 0.6667 and 0.3333 are their “weights”, or distances of to the second 1080 pixel.

So with linear interpolation, color of second pixel in 1080 should use same weights on colors of 720 pixels. 100%*0.6667 + 0%*0.3333 = 66.67% white, i.e. darker shade of gray.

A lot of math and programming.

Long story short, the system (phone, computer, whatever) has software and sometimes hardware that quickly does the needed calculations to adjust to resolution to the screen. If it does not divide evenly a system of correction is used. Pixels are “averaged together” or combined in some way to make a fitting scaled down version.

Others have delved into more details, but I think the ELI5 would be: imagine you have a screen with two pixels, one blue and one yellow, now you want to scale that image down to one pixel, as any 5 year old could tell you blue+yellow is green.

Now imagine you want to scale that screen to up to 3 pixels, a very naive approach would be make the transition smooth and put a green pixel in the middle, but this obviously makes the image blurry. Another naive approach is to replicate a given color, this works really good for pixel art, but makes the scaled image seem as blocky as the original was, except now each pixel is being drawn 4 or 6 times. E.g., imagine a 4×4 checkers board of black and white:

1 0 1 0

0 1 0 1

1 0 1 0

0 1 0 1

That would be escaled to a 8×8 like so:

1 1 0 0 1 1 0 0

1 1 0 0 1 1 0 0

0 0 1 1 0 0 1 1

0 0 1 1 0 0 1 1

1 1 0 0 1 1 0 0

1 1 0 0 1 1 0 0

0 0 1 1 0 0 1 1

0 0 1 1 0 0 1 1

Most stuff uses the first algorithm, games usually use the second and there are algorithms more complex that use a mixture of these two and others, trying to guess where are hard lines that should be preserved and where they should be smoothed.