Loading assets...
Understanding how image upscaling works, visually.
Image Upscaling
Recently, I found some old photos on my computer. They were all pretty low-res, so I looked into image upscaling to see if I could improve them.
That got me wondering how upscaling actually works. There's one thing in particular that made me curious.
As I understand it, an image is a grid of pixels, each holding a single color.
Upscaling adds more pixels. Upscale 4x in width and height, and you get 16 times as many.
But the extra pixels don't come with extra details. The color data is exactly the same.
If we just reuse the existing values, the picture looks the same, even with those extra pixels.
So how does an upscaling algorithm pick the right colors for those new pixels?
Turns out, it doesn't know if they're the right colors. It just guesses. And different algorithms guess differently.
AI upscalers predict colors using patterns they learned from lots of other images.
Traditional methods, like interpolation, assume the original pixels follow a mathematical relationship.
While AI may be the go-to solution today, in this article I want to focus on interpolation.
I think understanding it gives you a solid picture of what upscaling does, and makes other methods easier to learn later.
So I hope this story is useful for you too. Enjoy!
Essentially, interpolation estimates the values that fall between known values.
In upscaling, we use it to estimate colors for the new pixels between the originals.
You've actually already seen one interpolation method in action, called nearest-neighbor.
It's named that because it simply picks the color of the nearest known pixel.
The result is what you've seen earlier. This algorithm basically just stretches original color over its neighbors, so the upscaled image looks the same as the original.
Other interpolations mix colors from neighboring pixels, instead of copying one color.
I'll cover them how this is done soon, but first, a quick note:
Interpolation is usually done separately for each color channel.
You estimate a new pixel's red from the surrounding reds, and do the same for green and blue.
Then you combine the three estimates into the pixel's final color.
It's easier to picture with just one channel, so from here on I'll use only green.
I'll also use a 0–1 scale for intensity: 0 is no green, 1 is full green.
Let's step back to nearest-neighbor for a second: notice how it creates hard boundaries between pixels of different intensities.
You can see those steps stand out clearly when I scale each pixel's height by its intensity.
The other interpolation methods turn those sharp steps into gradual slopes.
Let's check out the first one: bilinear interpolation. It uses the nearest 4 pixels to estimate a target pixel's color.
It assumes the value changes linearly between neighboring pixels.
To get a pixel's value, you slide a marker along this linear path twice: once horizontally,
and once vertically.
The value at the marker's position is the value you assign to the pixel.
Now imagine this happening for every group of 4 pixels, across all color channels.
The result is much smoother transitions than nearest-neighbor gives you.
Slide the handle to compare the result between them.
The other interpolation work the same way. What differs is the path, and how many surrounding pixels shape it.
This is bicubic interpolation, and it uses the nearest 4×4 pixels instead of 2×2.
It follows a cubic curve instead of a straight line, producing smoother surfaces and gradients.
The rest is the same: to get the pixels value, slide the marker along the curve twice, horizontally and vertically.
Compared to bilinear, bicubic gives sharper edges and smoother gradients, though it takes a bit more math to compute.
Slide the handle to compare. The difference is subtle, but you can spot them best on sharp edges, like narrow tree branches.
Finally, Lanczos interpolation. It looks at an even wider neighborhood, like 6×6 or 8×8.
Its path uses a sinc-based curve, which dips lower where values drop sharply across an edge.
You can compare the path produced by bilinear, bicubic, and Lanczos with the selector above. Notice how Lanczos produces dips lower than the others.
That extra dip keeps details crisp, but can leave faint halos along sharp edges.
Then the same drill: slide the marker along the curve, horizontally then vertically.
Compared to bicubic, Lanczos preserves sharper details and finer textures, but needs more math across a wider pixel grid.
And that's the essence of image upscaling: it adds pixels, and those pixels need colors.
So the algorithm estimates them by looking at the surroundings and guessing what lies in between.
Interpolation makes that guess by assuming surrounding pixels follow a mathematical formula.
AI upscalers work on the same basis: they look at existing pixels and guess what comes in between.
The difference is that they use neural networks, trained on lots of images, to make the guess.
How that works would make a good topic, but maybe that's a story for another time.
Thanks for reading, and see you in the next story!
visualrambling.space is created by Damar, someone who loves exploring new topics and rambling about them visually.
If you enjoy this kind of visual article, please follow me on social media. I publish visual stories and sketches on all kinds of topics topics I found interesting.
I’m also open to collaborations and commissioned work. If you need help explaining a complex technical topic visually, feel free to reach out.
X/Twitter Bluesky LinkedIn RSS Email
Topics covered: Three.js, WebGL, visualization, interactive learning