Resampling Images |
|
|
||||||
|
||||||
The Resample process implements a general resampling procedure in PixInsight: given a source image, Resample generates a target image of the specified dimensions, with the help of a pixel interpolation algorithm. In addition, you can specify the image resolution in pixels and a corresponding resolution unit in the same resampling process, just for convenience. Instances of Resample cannot be executed on previews. The standard interface of Resample is the Resample window, whose usage is quite straightforward: You can select an image here, but this does not mean that the Resample process has to be necessarily applied to the selected image. The image selected is used just to inspect its dimensional properties and to use them as a basis to define the process parameters. You may wish to read a documentation section on view selection lists. When no selection is made on this list, the Resample window uses the dimensions and properties of the last image selected, if any, or a hypothetical RGB color image of 100x100 pixels by default. The Dimensions panel is where you can inspect and modify image dimensions in pixels, centimeters and inches. You can also specify relative sizes as percentages of actual target image dimensions. The Preserve aspect ratio check box is always checked by default, ensuring that the image proportions will be preserved while defining parameters. If you unselect this option, you can vary both image dimensions freely. You can enter a desired memory size here and the image dimensions will be automatically recalculated to match it. The existing aspect ratio will be preserved by the new dimensions. Memory sizes refer to the space required to store strictly the pixel data, not other elements that can be included in actual image files, like headers or metadata. You can specify a value in pixels for the image resolution and whether to interpret it in the metric (centimeters) or English (inches) system. The default values are 72 pixels per inch. The default interpolation algorithm is bicubic, which is appropriate for most images. You can read more on interpolation algorithms in a dedicated documentation section. This is the only complex part of the Resample window. The resampling operation is quite simple by itself, but the precise interpretation of resampling parameters is not obvious. You have the following possibilities to define how to apply a resampling operation:
IntegerResample resizes images by integer factors. A couple of examples will illustrate this:
In the figures, each square represents a pixel. When oversampling, each pixel in the source image is replicated to generate a square box of n×n pixels in the resampled image, where n is the resampling factor. Contrarily, each subsampled pixel is the arithmetic mean of n2 source pixels. Once we have defined the IntegerResample process, its interface window needs no explanation, except emphasizing once more that the selected image in the view selection list at the top is used just to give an example of how its dimensions would change, not to actually apply the process to it necessarily.
You can optimize some downsampling operations by applying a mix of IntegerResample and Resample processes. To obtain an smooth and accurate downsampled image you may consider dividing the whole process into two steps: First use IntegerResample to approximate the final desired dimensions, and then apply a final Resample to achieve them. This technique gives excellent results for downsampling star trail images. Star trail arcs are often poorly interpolated if a single resample operation is used to reduce the size of an original image significantly, yielding broken or abrupt trails. For example, suppose you have a star trail original image of 4300×2800 pixels, and you need a reduced version, say 450 pixels wide, to show the image on a webpage. Instead of applying a single Resample, you might consider using IntegerResample with a subsampling factor of 9, which yields 477×311 pixels, and then Resample to the desired 450×293 final size. Or you could perform an initial IntegerResample with subsampling factor of 7, which gives 614×400 pixels, giving more relevance to the final Resample. When applying this two-step downsampling technique, you usually want to make some trial and error work to decide how to balance between both processes. |