<p>In essence a image is  a group of point samples (read <a href="http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf" rel="nofollow noreferrer">A pixel is not a little square<sup>3</sup></a>). When you transform or scale the image you need to resample it. So what you do, theoretically, is take the point samples and convert them into a continuous function. Then you sample that continuous function and reconstruct a signal. So, there are two or three different phases here.</p>

<ol>
<li>Converting the samples to a continuous function, (function reconstruction).</li>
<li>(Transforming)</li>
<li>Re-sampling the signal</li>
</ol>

<p>Note that none of these steps have a fixed form. In practice, when optimized, it's impossible to tell that there are steps. The transformation does not really have to be simple it could be mapping the shape into a spiral etc. </p>

<p><a href="https://i.sstatic.net/WWaeC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WWaeC.png" alt="Reconstruction of signal"></a></p>

<p><strong>Image 1</strong>: A 1-D signal reconstructed by different filters.</p>

<p>In practice, quite a bit of lore is known about signal reconstruction in the signal processing field. Designing these filters and choosing the right one is a art form on its own. But, in essence, the choice of filter is a tradeoff between blurring and <a href="https://en.wikipedia.org/wiki/Ringing_artifacts" rel="nofollow noreferrer">ringing</a>. Of course the algorithm also has other qualities such as how many instructions it takes to implement and how fast and how much memory it needs etc. Which can be very important in realtime or embedded applications.</p>

<p><a href="https://i.sstatic.net/XNqUx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XNqUx.png" alt="The process"></a></p>

<p><strong>Image 2</strong>: Overview of entire process.</p>

CC BY-SA 3.0
2016-01-06T18:56:31.283Z
2016-05-05T14:56:32.470Z
2016-05-05T14:56:32.470Z
joojaa
<p>There are numerous upscaling and downscaling algorithms available to scale images from any resolution to any other arbitrary resolution. Each algorithm typically involves a trade-off between efficiency, smoothness and sharpness, with varying degrees of each trade-off for different algorithms.</p>

<p>Check out <a href="https://en.wikipedia.org/wiki/Image_scaling#Scaling_methods" rel="nofollow">this Wikipedia article</a> for such algorithms and examples of such algorithms.</p>

<p>The most popularly known (and used) algorithm is the <a href="https://en.wikipedia.org/wiki/Bicubic_interpolation" rel="nofollow">Bicubic interpolation</a> algorithm. It interpolates between 2D points on a rectangular grid. Using <a href="https://en.wikipedia.org/wiki/Cubic_Hermite_spline" rel="nofollow">Cubic Splines</a> (or Cubic Interpolation), It first interpolates on one dimension (finds the interpolated row/column), then interpolates the interpolated row/column in the other dimension.</p>

<p>Bilinear interpolation is similar to Bicubic interpolation, except the former interpolates using a linear function and can interpolate only between two values and the latter uses a cubic function and can interpolate between four values.</p>

<p>The simple function for Bicubic interpolation is as follows:</p>

<pre><code>f(f(p00, p01, p02, p03, y),
  f(p10, p11, p12, p13, y),
  f(p20, p21, p22, p23, y),
  f(p30, p31, p32, p33, y),
  x)
</code></pre>

<p>where (x, y) is the interpolated position and p[][] is the 2d array representing the 4 * 4 grid.</p>

<p>Check <a href="http://www.paulinternet.nl/?page=bicubic" rel="nofollow">this link</a> for more information and example code, which really helps a lot!</p>

CC BY-SA 3.0
2016-01-06T07:59:53.697Z
2016-05-03T16:13:54.833Z
2016-05-03T16:13:54.833Z
EvilTak
<p>While the other answers given are correct I'm not sure they entirely answer your question. In order to not get black bars you have 2 options if the destination is not the same shape (or aspect ratio) as the source:</p>

<ol>
<li><strong>Fill the destination leaving some pixels from the source out of the destination.</strong> In your example, the source is 1024x768 and the destination is 1920x1080. If you scale the original image up so the result is 1920x1440, you can then crop the top and/or bottom off to make it 1920x1080.</li>
<li><strong>Stretch the destination image to fit.</strong> So you'd scale vertically by 1080/768 = 1.40625, and scale horizontally by 1920/1024 = 1.875. This is almost never what you want, and looks terrible in most cases. (This is what makes people look much wider than they should, and turns circles into ovals and rotations into shears.)</li>
</ol>

<p>There's another option, but it doesn't fit your criteria - scale uniformly, but only until 1 dimension is as big as the destination. In this case you would scale both horizontally and vertically by 1.40625 to get a result of 1440x1080. This is usually referred to as "scale to fit".</p>

<p>For any of these options you can use whichever scaling algorithm meets your needs.</p>

CC BY-SA 3.0
2016-05-06T08:23:02.803Z
You could also have white bars. You can also use some image synthesis function to fill the pixels you can overlay a picture with itself  one that is cropped and one that stretches for example. here simply is a infinite amounts of ways to deal with no data. I think most of us just assumed its going to be a nonuniform scale.
joojaa
CC BY-SA 3.0
2016-05-06T15:44:30.103Z
Very true. I assumed the original poster specifically didn't want to fill with a solid color and was interested only in the scaling aspect, since that's what they asked about. But there are lots of other fill methods. There are also non-linear scaling methods, where the center maintains its aspect ratio and the edges are stretched out, for example.
user1118321
CC BY-SA 3.0
2016-05-06T01:23:24.967Z
2016-05-06T01:23:24.967Z
user1118321
<p>Without there being black bars I mean. 1080 isn't any multiple of 768 so is there some sort of data loss?</p>

CC BY-SA 3.0
2016-01-03T13:09:54.743Z
There are scaling algorithms like bicubic scaling which use splines to approximate the color of pixels when scaled to any size.
EvilTak
CC BY-SA 3.0
2016-01-05T16:37:23.030Z
@EvilTak, can you expand your comment into an small answer?
glampert
CC BY-SA 3.0
2016-01-06T08:00:26.423Z
@glampert did that. Do you want me to remove my comment?
EvilTak
CC BY-SA 3.0
2016-01-06T14:27:11.127Z
@EvilTak, I think you can leave it. Nice answer btw, thanks!
glampert
<pixel-graphics>
How does a computer upscale 1024x768 resolution to 1920x1080?
V0ight
# How does a computer upscale 1024x768 resolution to 1920x1080?

(Asked by: username_0 on 2016-01-02)

Without there being black bars I mean. 1080 isn't any multiple of 768 so is there some sort of data loss?

**Tags:** pixel-graphics

> **Comments:**
> **username_1**: There are scaling algorithms like bicubic scaling which use splines to approximate the color of pixels when scaled to any size.  
> **username_2**: @username_1, can you expand your comment into an small answer?  
> **username_1**: @username_2 did that. Do you want me to remove my comment?  
> **username_2**: @username_1, I think you can leave it. Nice answer btw, thanks!  

---

## 3 answers

### Answer by username_3 on 2016-01-06. Score: 8

In essence a image is a group of point samples (read [A pixel is not a little square3](http://alvyray.com/Memos/CG/Microsoft/6_pixel.pdf)). When you transform or scale the image you need to resample it. So what you do, theoretically, is take the point samples and convert them into a continuous function. Then you sample that continuous function and reconstruct a signal. So, there are two or three different phases here.

1. Converting the samples to a continuous function, (function reconstruction).
2. (Transforming)
3. Re-sampling the signal

Note that none of these steps have a fixed form. In practice, when optimized, it's impossible to tell that there are steps. The transformation does not really have to be simple it could be mapping the shape into a spiral etc.

[![Reconstruction of signal](https://i.sstatic.net/WWaeC.png)](https://i.sstatic.net/WWaeC.png)

**Image 1**: A 1-D signal reconstructed by different filters.

In practice, quite a bit of lore is known about signal reconstruction in the signal processing field. Designing these filters and choosing the right one is a art form on its own. But, in essence, the choice of filter is a tradeoff between blurring and [ringing](https://en.wikipedia.org/wiki/Ringing_artifacts). Of course the algorithm also has other qualities such as how many instructions it takes to implement and how fast and how much memory it needs etc. Which can be very important in realtime or embedded applications.

[![The process](https://i.sstatic.net/XNqUx.png)](https://i.sstatic.net/XNqUx.png)

**Image 2**: Overview of entire process.


---

### Answer by username_1 on 2016-01-06. Score: 5

There are numerous upscaling and downscaling algorithms available to scale images from any resolution to any other arbitrary resolution. Each algorithm typically involves a trade-off between efficiency, smoothness and sharpness, with varying degrees of each trade-off for different algorithms.

Check out [this Wikipedia article](https://en.wikipedia.org/wiki/Image_scaling#Scaling_methods) for such algorithms and examples of such algorithms.

The most popularly known (and used) algorithm is the [Bicubic interpolation](https://en.wikipedia.org/wiki/Bicubic_interpolation) algorithm. It interpolates between 2D points on a rectangular grid. Using [Cubic Splines](https://en.wikipedia.org/wiki/Cubic_Hermite_spline) (or Cubic Interpolation), It first interpolates on one dimension (finds the interpolated row/column), then interpolates the interpolated row/column in the other dimension.

Bilinear interpolation is similar to Bicubic interpolation, except the former interpolates using a linear function and can interpolate only between two values and the latter uses a cubic function and can interpolate between four values.

The simple function for Bicubic interpolation is as follows:

```
f(f(p00, p01, p02, p03, y),
  f(p10, p11, p12, p13, y),
  f(p20, p21, p22, p23, y),
  f(p30, p31, p32, p33, y),
  x)

```

where (x, y) is the interpolated position and p[][] is the 2d array representing the 4 \* 4 grid.

Check [this link](http://www.paulinternet.nl/?page=bicubic) for more information and example code, which really helps a lot!


---

### Answer by username_4 on 2016-05-06. Score: 0

While the other answers given are correct I'm not sure they entirely answer your question. In order to not get black bars you have 2 options if the destination is not the same shape (or aspect ratio) as the source:

1. **Fill the destination leaving some pixels from the source out of the destination.** In your example, the source is 1024x768 and the destination is 1920x1080. If you scale the original image up so the result is 1920x1440, you can then crop the top and/or bottom off to make it 1920x1080.
2. **Stretch the destination image to fit.** So you'd scale vertically by 1080/768 = 1.40625, and scale horizontally by 1920/1024 = 1.875. This is almost never what you want, and looks terrible in most cases. (This is what makes people look much wider than they should, and turns circles into ovals and rotations into shears.)

There's another option, but it doesn't fit your criteria - scale uniformly, but only until 1 dimension is as big as the destination. In this case you would scale both horizontally and vertically by 1.40625 to get a result of 1440x1080. This is usually referred to as "scale to fit".

For any of these options you can use whichever scaling algorithm meets your needs.

> **Comments:**
> **username_3**: You could also have white bars. You can also use some image synthesis function to fill the pixels you can overlay a picture with itself  one that is cropped and one that stretches for example. here simply is a infinite amounts of ways to deal with no data. I think most of us just assumed its going to be a nonuniform scale.  
> **username_4**: Very true. I assumed the original poster specifically didn't want to fill with a solid color and was interested only in the scaling aspect, since that's what they asked about. But there are lots of other fill methods. There are also non-linear scaling methods, where the center maintains its aspect ratio and the edges are stretched out, for example.  

---

