Resampling Images



::Index  <Prev  >Next

The Resample Process

View Selection List

Dimensions

Memory Sizes

Resolution

Interpolation

Process Mode

The IntegerResample Process

Optimized Downsampling Operations



The Resample Process

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:


View Selection List

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.


Dimensions

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.


Memory Sizes

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.


Resolution

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.


Interpolation

The default interpolation algorithm is bicubic, which is appropriate for most images. You can read more on interpolation algorithms in a dedicated documentation section.


Process Mode

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:

  • Relative Resize
    The default option. Only percentual dimensions are taken into account; the rest of parameters are ignored. The resampling process will apply the exact rescaling defined by the width and height values as percentages.
  • Absolute Dimensions in Pixels / Centimeters / Inches
    The resampled image will be forced to have the width and height in pixels, centimeters or inches, depending on the specific option selected, as given by the corresponding parameters. The Preserve aspect ratio check box setting will be ignored.
  • Force Size in Pixels per Channel
    The resampled image will have pixels enough as to fill the specified memory size The Preserve aspect ratio check box setting will be ignored, since the resampled image will have the exact aspect ratio defined by the width and height parameters.
  • Force Resolution
    This option is independent of the rest. When selected, this option also changes the resolution and resolution unit of the target image. To define a Resample instance to set resolution parameters only, without actually resampling pixels, select this option and the Relative Resize mode, with both percentual dimensions at 100%.


The IntegerResample Process

IntegerResample resizes images by integer factors. A couple of examples will illustrate this:

Integer Resample: Oversampling factor 2.
V is the source pixel.

 

Integer Resample: Subsampling factor 3.
V is the resampled pixel

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.


Optimized Downsampling Operations

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.



::Index  <Prev  >Next