What is bicubic resampling?

Introduction

If you know the term bicubic resampling, you probably assume that it is a specific algorithm used to resize images. Unfortunately, that’s not the case. In this document, I’ll try to get to the bottom of what it really is.

The analysis in this document was done with the help of ResampleScope.

If some of this doesn’t make sense, it may help to read my document about resampling.

Bi-?

Let’s get the “bi” part of the name out of the way first. “Bi” is supposed to mean that you apply the algorithm in two dimensions: horizontally and vertically.

One problem is that the terminology is used inconsistently. If you apply, for example, Lanczos or Mitchell resampling in two dimensions, their names don’t change to “Bilanczos” or “Bimitchell”. For some reason, only cubic and linear get their names changed.

Another reason that “bi” seems unnecessary is that the number of dimensions does not really affect the algorithm. It’s exactly the same; the only difference is how many times you apply it.

I suggest ignoring the “bi”, and just thinking of it as “cubic” resampling. Some applications do use this terminology.

Cubic resampling

Broadly speaking, cubic resampling means little more than “any algorithm in which the most sophisticated mathematical operation is to take the cube of a number”.

More strictly, we only consider cubic filters which have a certain maximum width (a radius of 2), and which are symmetric, unbiased, continuous and smooth, etc. Fortunately, there are only a limited number of filters which meet all the requirements. In a 1988 paper, Mitchell and Netravali showed that, given these constraints, there are only two free parameters remaining, which are usually named B and C. Here’s the general formula for this entire family of cubic filters:

k(x) = 1/6 ...

So, we have a two-dimensional space containing all the interesting cubic resampling algorithms. I will use the notation cubic(B,C) to refer to a specific algorithm in this space.

The cubics for which C=0 are called the “B-spline” cubics. They are the ones that do not produce any ringing artifacts. If “B-spline” is used to refer to a specific algorithm, it means cubic(1,0).

The cubics for which B=0 are known as the cardinal cubics. They are the ones that do not have any inherent blurring. By that, I mean if you apply a cardinal cubic to an image without changing the image size, it will leave the image pixels completely unchanged.

The contenders

Suppose your imaging software offers a resampling filter named “cubic” or “bicubic”. What exactly is it?

The only way to know is to try it and see. You could take a small image of a thin line: , enlarge it by a large factor, and graph a cross-section of it.

In the cases below, I’ll also enlarge this sample image: , to give you a better idea of what the filter does.

Technical note: Gamma correction was used when resizing the smiley image, but not the thin line test pattern, to make it simpler to graph.

1. B-spline

In some applications, “bicubic” means cubic(1,0). Other applications don’t call this filter “bicubic”, and instead use the less-ambiguous name “B-spline.” Though it’s sometimes useful, it’s very blurry, so it’s usually not the best choice.

Examples of software which may use this for “bicubic” (or “cubic”): ImageMagick, Paint.NET

2. Mitchell

It’s also common for “bicubic” to be a Mitchell filter, which is cubic(1/3,1/3).

Examples of software which may use this for “bicubic”: FreeImage, Imagine

3. Catmull-Rom

Some applications use a Catmull-Rom filter when you ask for “bicubic”. This is cubic(0,1/2).

Example of software which may use this for “bicubic”: GIMP

4. Unnamed cardinal cubic (0.75)

I’ve only seen one application that uses cubic(0,0.75), but it’s a popular application, so I include it in this list. It’s not clear to me why one would choose this over Catmull-Rom.

Example of software which may use this for “bicubic”: Photoshop

See also: Notes on Photoshop’s image resize algorithms

5. Unnamed cardinal cubic (1.0)

I’ve seen several applications and code samples in which “bicubic” is cubic(0,1). If this filter has a common name, I’m not aware of it. This is a rather poor filter, so when I see it implemented, I tend to assume that it was selected by someone who didn’t realize there were other options.

Example of software which may use this for “bicubic”: FastStone

Other possibilities

Some applications might not use anything in cubic(B,C) space. They may use a blurred or sharpened cubic, or something else entirely.

Some applications may be optimized for speed, and use only an approximation of a cubic filter.

Some applications may not use a fixed cubic filter, but instead vary the parameters depending on the scaling factor.

Note that it’s common for an application to use a different algorithm when downscaling than it does when upscaling. Downscaling algorithms are more varied than upscaling algorithms, and more difficult to analyze.

Some applications may post-process the image after resizing it. I’m referring especially to the practice of sharpening an image after downscaling it.