|
Resampling
Resampling is very different from scaling. Resampling changes the image size in pixels. It does not (normally)
change image resolution (which at this point is just a number used for printing). Resampling is the only tool
we have to change the video size of an image, but Resampling is not typically used to affect the size of images
to be printed.
Resampling interpolation . We normally reserve that word for Resampling to a larger image, however it's the same
recalculation process either way, to a different grid spacing. The only difference is that reducing image size
discards data and detail (replaces many dots with a few, sometimes called down sampling), and increasing size to
a larger image must fabricate additional data (replaces a few dots with many, sometimes called upsampling). The
image is simply larger, but no additional detail is possible without another scan of course.
This is the image we are Resampling, it's a polar bear in a snow storm. It's a little fuzzy, but work with me on
this. It's divided into 4 black intervals and 3 red intervals, to suggest the old 400x400 grid and the new
300x300 grid on the same image. The 400x400 image is actually 1/3 larger physically, they are NOT the same size,
but the abstract concept here is that the pictorial image is the same, the polar bears head looks the same in both
picture frames, and in particular, on both grids.
Basically what Resampling does, is that in order to create a RGB color sample for every dot position in the new
300x300 grid, say the one blue pixel (don't ask!), which is located 67% over from the left edge and 33% down from
the top, the software goes to the corresponding location in the old 400x400 grid data, to the 67% X and 33%
Y position of that image, and "resample" or reads the RGB color there. The old 400x400 grid possibly has
no pixel exactly at that precise location, because obviously the two grids cannot be aligned, but there are nearby
real neighbours of that imaginary point from which to sample the color value.
Not all pixels in the larger old image will necessarily be sampled, because down sampling means that many old pixels
are discarded, the limited number of new pixels have no need to look at all of them. Or when upsampling, some pixels
in the smaller old image get sampled more than once when fabricating new pixels that are more densely populated.
Meaning much data is simply repeated in the new larger image. It would of course be better to go back and resample
the original photograph (scan it again), but it must not be available now (or we would).
Some programs do this Resampling calculation better than others. Adobe Photoshop offers these three Resampling
choices:
1) Nearest Neighbour creates the new pixel simply to be the same color of the one closest adjacent old pixel
(fastest, and usually best for hard-edged graphics, but too crude for photo images).
2) Bilinear creates the new pixels to be the color interpolated from linearly weighting the value and distance
of the old pixel on either side of the new pixel on the same row. "Bi" repeats this vertically, creating
new rows using those new pixels.
Or 3) Bicubic creates the new pixels from the color of two pixels in either direction, using cubic equations to
"best fit" the new point within the four existing points. "Bi" repeats this vertically, creating
new rows using the new pixels. Calculating millions of pixels is slow work, but our computers are much faster today,
and the best methods are not such difficult feats anymore. Bicubic mode is more accurate, important if Resampling
larger, but it is still interpolation. Calculating new pixels from old data is NOT the same as actually sampling real
new data from the original.
People often assume that Resampling images to an integer divisor (like to 1/2 or 1/3 size) simply uses only every
second or every third sample (nearest neighbour), but that's not often true. This was common years ago when computing
power was primitive and it was all the hardware could manage then. It is still the best technique for Resampling
graphics, because otherwise Resampling by blending two pixel values together creates a new intermediate value which
blurs any sharp edges.
Continuous tone photo images are anti-aliased anyway, and are better resample by using all existing samples. They
already exist anyway, available for free. The excess or "discarded" samples can then still have an effect on
the final image. If one of those pixels was a black speck, like maybe a very distant bird in the sky, at least maybe
we have a gray spot left. The algorithm to resample to 150 ppi or to 153 ppi is normally one and the same method.
However, it is still true that the results can be a little sharper if Resampling to an even fraction of the original,
when the old grid and new grid are aligned, so a 150 ppi choice may in fact be better than 153 ppi (see next page).
The scanner resample too
A 300 dpi scanner has 300 dpi CCD cells, and when we scan at 130 dpi, it must resample the 300 dpi scan line to 130
dpi. Some scanners use bilinear and some use nearest neighbor, to resample the scan line horizontally. All scanners
must use nearest neighbor vertically, because the carriage motor only stops to sample lines at every 1/130 inch in
this case.
Some people claim it is better to always scan at full 300 dpi optical resolution and then resample back to 130 dpi
in an external program. Their point is that the program like Photoshop has a better resample technique than the
scanner, and your computer has much more memory and processor power than the scanner. Should we do this with a 1200
dpi scanner too? Gracious, then don't buy one of those. <grin> That would be a very large image.
Along those same lines, some also claim that we can scan at less than full optical resolution, but that we should
scan only at values of full optical resolution divided by integers (1, 2, 3, 4, etc.). So for a 300 ppi scanner, the
idea is that we should scan only at 300 or 150 or 100 or 75 ppi, instead of values like 80 or 130 ppi. Many scanners
only provide these integer choices. The idea is that an integer divisor makes Resampling easier, with better results,
because the new grid and old grid are always aligned. We would scan at the next higher integer resolution, and then
down sample slightly to the desired size (externally). For example, scan at 150 ppi and resample to 130 ppi size.
Note that 600 ppi scanners have additional integer divisor values of 200 ppi and 120 ppi not available to a 300 ppi
scanner. 1200 ppi scanners add 400 and 240 ppi. Even divisors of 2, 4, 8 are likely better than odd divisors like
3 or 5, but any integer divisor is probably better than other values, like 58%. There is indeed sometimes a slight
improvement using integer divisors, and you should be aware of the choices available to you. Your results and
choice may be affected by how well your image program performs Resampling in comparison to the scanner. You should
experiment and decide for yourself in your situation. See next page for a sample of these techniques.
Go back to Ezine articles
|