Upsampling in Photoshop

Wednesday, September 15th, 2004

The nice thing about writing a quasi-technical blog is that I can be as vague as I want when it comes to details, proofs, formulae etc. So when I want to write about some interesting algorithm or whatever, I only have to investigate it as far as it suits me to, and then I can just get distracted and think about something else… like sausages… So anyhow, let’s get [quasi] technical about image processing! Yay!

Photoshop is an interesting tool, especially if you take the word interesting to mean “not nearly as useful and powerful as it should be, considering its maturity”. One of the things that Photoshop [along with every other image processing tool in the universe] will often be used for is upsampling. Upsampling is the thing where you resize a small image to a bigger one, interpolating extra pixels in the process.

The image to the right attempts to illustrate the three different types of upsampling available in Photoshop [v6.0]. The left column shows the 8 original pixel values. From these the middle column was created using bilinear interpolation and the right hand one using bicubic interpolation.

By default, upsampling is done using bicubic interpolation and everyone [including me] assumes that it’s the best for photos and continuous tone images, but this is not necessarily the case.

Problem #1: A steadily changing series of samples get bicubically interpolated in such a way as to introduce corrugations which should not be there! The following 3 figures illustrate this effect perfectly.


no interpolation


bilinear


bicubic

Problem #2: Bicubically interpolated pixel values can be beyond the range of the original image, resulting in an overall sharpening effect, and in some cases clipping [where solid patches in the final image turn out either totally black or totally white]


no interpolation


bilinear


bicubic

What’s actually going on with the first problem I can’t say for sure [cubic interpolations of continuous samples do not normally wobble], but I suspect the second problem may provide a clue; a straight cubic function applied to sample data will tend to overshoot the source range quite a lot, and it possible that the attempt to mitigate the second problem has effectively introduced the first.

Regardless of the hows and whys — which maybe I’ll look at in more detail sometime — bicubic interpolation is NOT always better, even if it’s smoothness you’re after. The humble no-fuss bilinear will often serve you best.

feed

Leave a Comment