Test: scaling images up
I was playing around with scaling up images in The GIMP and stumbled upon a method (scale to larger than you need, then scale down to the desired result) that seemed to get exceptionally good results.
I wanted to find out if this was a fluke, so I ran some tests.
My conclusion appears to be either that playing around to find the right method is exactly what you need, or that more tests are needed.
Scaling images up means that if you have an image of a certain size (w × h pixels), you produce a version of that image that is larger (e.g. 2w × 2h pixels).
Unlike what Hollywood shows like to pretend, this does not lead to images of an equal aesthetic. Upscaling an image generally leads to ugliness, so it is your task to find the method that works best. If you have access to a larger original of the image you are about to scale up, it is almost always better to work from that original image.
Upscaling works by inventing new pixels. The algorithm must take guesses as to what such a new pixel would look like. Typically this works by using neighbouring pixels as hints at least somewhere in the process.
Illustration: how do you scale a 2 pixel wide image to a 3 pixel wide one? You could choose to only copy pixels, meaning that the ratio between the 2 halves of the image will become skewed, or you could choose to mix pixels, meaning there will be colours in the image that weren’t there before.
In the following, your browser may itself scale images up or down to make them fit the available space. I chose widths to scale to that should work fine with the current settings of my blog, but you may have to view the images separately to get a real impression of what they look like.
I started this test with two images:
– The source image, 300 pixels wide.
– The comparison image, 600 pixels wide.
Both images were produced by scaling down (method: cubic) from an approximately 1600 pixel-wide original.
The 300 pixel version would be the source of all the upscale tests, the 600 pixel version would serve as the control—as the ideal target.
All tests were performed with The GIMP.
The GIMP has traditionally had three scaling settings: none, linear and cubic.
‘None’ will try and fit pixels into new pixels, duplicating and discarding pixels where necessary. The result will look blocky regardless of whether you are scaling up and down. In my experience, the best use case for ‘none’ is when you are scaling up or down to exact halves, quarters, eights or doubles, quadruples, octuples et cetera.
‘Linear’ and ‘cubic’ are siblings, they mix pixels where necessary, with cubic doing this the strongest. Cubic is brilliant for scaling down.
I used two target widths: 400 pixels and 600 pixels.
(There is no 400 pixel control image, but I trust the 600 pixel image will suffice here.)
I applied the following tests:
none: scale up to the target width using scaling algorithm ‘none’.
lin: scale up to the target width using scaling algorithm ‘linear’.
cub: scale up to the target width using scaling algorithm ‘cubic’.
none + cub: scale up to more than the target width using scaling algorithm ‘none’, then scale down to the target width using scaling algorithm ‘cubic’.
Scaled to 400 pixels wide (factor 1.3)
Scaled to 400 pixels wide using ‘none’:
Scaled to 400 pixels wide using ‘linear’:
Scaled to 400 pixels wide using ‘cubic’:
Scaled to 400 pixels wide by scaling up to 600 pixels wide using ‘none’, then scaling down to 400 pixels wide using ‘cubic’:
Scaled to 600 pixels wide (factor 2)
Scaled to 600 pixels wide using ‘none’:
Scaled to 600 pixels wide using ‘linear’:
Scaled to 600 pixels wide using ‘cubic’:
Scaled to 600 pixels wide by scaling up to 900 pixels wide using ‘none’, then scaling down to 600 pixels wide using ‘cubic’:
My hope had been that the latter would provide the best upscaled images, but to be honest, I do not see much difference between scaling up with the linear setting and the method where you first scale up and over using none, then scale down using cubic. In fact, having done some pixel peeping I think that I prefer—for this test at least—the images scaled up using the Linear algorithm.
(Show here the difference between a linearly upscaled image and an image scaled up using the scale-over-then-down method.)
All images were saved at JPEG quality level 82, for no other reason than that is my default setting.
Leave a Reply