GIMP Guru

Upsampling

Stairstep Upsampling

One shot Stairstep

There are times when you need to scale up an image because you don’t have enough pixels in it (e.g. for making a large print at an acceptable resolution). The generally accepted wisdom on upsampling (at the time of this writing) using conventional interpolation algorithms (e.g. bicubic) is that better results are obtained resampling in discrete “steps” up to the desired target resolution, rather than upsampling in one fell swoop.

For example, suppose you have a 1536×2048 pixel image. It is a sharp image and you want to make a 15×20 inch print of it at 240 pixels per inch (PPI). To do this you would need to upsample the image to

(15 * 240) x (20 * 240) or 3600x4800 pixels. 

If you used the “stairstep” method you might choose 10% steps, i.e.

1690x2252, 1860x2476, 2046x2724, ...

I am not exactly sure of the rationale behind this technique, other than the somewhat intuitive notion that iterating the interpolation using smaller steps provides better intermediate values for propagation, particularly in the way of edge definition. In any case, I decided to test this technique myself directly, and wrote a script-fu to do stairstep resampling.

The Procedure

For this test, I took a 256×192 crop from this image.
Here’s the crop, at 100%. This has not been altered in any way.
I duplicated the image (Ctrl+D). In the first image, I ran a regular Image/Scale, increasing the size to 600×450. This corresponds to the same increase from 2048×1536 to 4800×3600, as discussed above.In the second image, I ran this script. I used a stairstep size of 10%, as shown at right.
The results are interesting. Top right, normal scaling; bottom right, stairstep. Neither image has had any post-upsampling sharpening at this point.The first thing I am struck by is how the noise in the dark green area is much more subdued in the stairstep resampled version.

The second thing I notice is that the stairstep version looks less pixelated along the edges of the petals and other parts of the image; it has more “antialiased” edges.

The stairstep upsampled version looks slightly softer overall compared to the scaled version. This suggests to me that slightly more aggressive sharpening may be needed if this technique is used.

The proof is in the print! Download the script, stick it in your scripts folder of your gimp installation and try it out. Print one version upsampled with one-shot scaling and one version with stairstep resampling. I’d be interested in hearing how it works for you.

GIMP Image/Scale (bicubic, one shot)
GIMP Stairstep (stairstep-resample.scm)
Some folks will wonder how this technique compares to other upsampling methods such as Lanczos, S-Spline or Genuine Fractals. I’m mostly interested here in what I can do from the GIMP and not these other programs, but for curiosity’s sake I will post some other examples as I get them.If you want to play around with the sample crop, here it is.
Lanczos (using Image Magick)
S-Spline (www.s-spline.com)

Further Reading

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.