Lánczos Interpolation Explained (2022)

https://news.ycombinator.com/rss Hits: 88
Summary

2022-10-07 Lánczos interpolation explained Lánczos interpolation is one of the most popular methods to resize images, together with linear and cubic interpolation. I’ve spent a lot of time staring at images resampled with Lánczos, and a few years ago, I wondered where it came from. While many sources evaluate interpolation filters visually, I couldn’t find a good explanation of how Lánczos interpolation is derived. So here it is! In this post I do not attempt to explain what a Fourier transform does, so if you do not know that already you might find the mathematical details unclear. However, I do try to visualize and explain the intuition behind all the ideas. Before we begin, the images below showcase a variety of images resized with no interpolation, linear interpolation, and Lánczos interpolation. Lánczos produces non-blocky, sharp images, both when upscaling and downscaling. Gutenberg Bath Quixote Place Renoir Peacock Nearest Linear Lánczos Nearest Linear Lánczos Nearest Linear Lánczos Nearest Linear Lánczos Nearest Linear Lánczos Nearest Linear Lánczos 4 2 1 ½ ¼ We will proceed as follows: A description of the problem we’re trying to solve; How interpolation can be phrased in terms of convolutions; An introduction to \mathrm{sinc}, the “best” interpolation function, together with a quick recap on Fourier transforms; A concrete example of interpolating with \mathrm{sinc}; Why we can’t and shouldn’t use \mathrm{sinc} directly; How \mathrm{sinc} can be modified to make it work well in practice; Some closing thoughts. If you’re already familiar with Fourier analysis, section 6 might still be of interest, given that it explains the main ideas behind Lánczos interpolation. Let’s get started. The problem # When resizing an image, we generally have a specific target size in mind. In this post, we focus on the general problem of “filling in” the gaps between regularly spaced samples — that is, interpolating. Once we know how to interpolate between samples, we can resamp...

First seen: 2025-10-10 20:33

Last seen: 2025-10-11 16:15