Style: Resample

Controls in the Options tab of the Style pane manage hill shading and low-level resampling / rendering of images.  This topic covers the Resample control in the Options tab, which controls how pixels are interpolated when zoomed far into the image.



The Resample control works with all types of images.  It sets the method of interpolation used when the view is zoomed so far into an image that a single pixel of data is displayed by multiple pixels in the computer monitor.   There are two settings: bilinear (the default) and nearest neighbor.



The default setting for Resample is bilinear interpolation.   That provides an image with a natural appearance.  The image above is a three channel RGB image that is a drone photograph.



We zoom farther into the image, approximately into the middle of the image.   At this zoom level, individual pixels in the data cover more than one pixel in the computer monitor.   The default bilinear interpolation used for resampling the image on the fly generates a smoother, more natural look even though the image is now being displayed in a closer view than the natural resolution of one data pixel for one pixel on the computer monitor.



We can use the pull down menu in the Resample box to choose nearest neighbor interpolation and then pressing Update Style.


Resampling using nearest neighbor interpolation does not smooth out multiple pixels used to represent a single data pixel, but in instead uses a square of a single color, the data pixel's color, for all pixels on the computer monitor that show each particular data pixel.   The result is a display of squares with sharp edges, one square for each data pixel.



We can see the effect more clearly by zooming farther into the image.   The illustration at left above shows Resample set to nearest neighbor while the illustration at right above shows the bilinear choice.    Bilinear interpolation takes more computation when resampling images to handle zoom levels, but it results in a more natural look, so Manifold uses it by default.   Other GIS packages often use nearest neighbor interpolation by default, since it is easier to compute and thus helps the package show bigger images faster.



When zoomed out, there is little visual difference between using nearest neighbor interpolation (at left above) and bilinear interpolation (at right above) in the Resample control.  However, if we look closely at the white border lines on the road, or at the light-color power line sin the lower left of the image just above the road, we can see that using nearest neighbor interpolation can produce moiré effects or jagged renditions of lines or other boundaries.   The image also looks crisper, as if the edges of objects were sharpened.


The Resample control also works with images created from a single channel and colored with a palette, such as terrain elevation images, whether they are hill shaded or not.



The image used above is the same terrain elevation image used in the Style: Contouring using Colors  topic.  When rendered using hill shading and the bilinear choice for Resample interpolation it has an even, smooth, appearance.



Zooming farther in to a zoom level where individual data pixels cover more than one pixel on the computer monitor, the sharp distinctions in colors used show approximately where the boundaries are between each data pixel.  However, bilinear interpolation is so effective at smoothing out transitions that the hill shading appears smooth even when zoomed far into the image.



Use the pull down menu in the Resample box to choose nearest neighbor interpolation and then press Update Style.   That switches resampling to using nearest neighbor interpolation.


The display now uses squares of the same color, with sharp edges, to represent the regions covered by each data pixel.   The hill shading interpolation that colors each data pixel is so smooth that we have to zoom farther in to see more clearly how each data pixel has sharp edges.



We can zoom far in and compare nearest neighbor interpolation at left above with bilinear interpolation at right above.   No matter how far in we zoom, bilinear interpolation will try to smooth out the differences between data pixels.



When zoomed far out, displays created from single channel data will often seem very similar no matter if we use nearest neighbor interpolation or bilinear interpoation in the Resample control.  The illustration at left above uses nearest neighbor interpolation and seems sharper.  The illustration at right above uses bilinear interpolation and seems smoother.


The choice of interpolation method in the Resample box depends on our preferences and workflow.  If we are editing individual pixels, then it makes sense to switch to nearest neighbor interpolation.   For almost all other purposes, the default bilinear interpolation will provide a better appearance for the image.



Changes Persist when Saved - Changes to the Resample setting for an image are persistent if we save the project.  The next time the project is opened and the image is opened, the setting will remain as we last set it.


See Also





Style: Contouring using Colors


Style: Hill Shading


Style: Resample