User Guide > Displaying Images > Image Magnification and Reduction
  

Image Magnification and Reduction
The size of the area written on the screen, measured in pixels, is identical to the dimensions of the image expression. Some output devices have hardware zoom and pan, which can blow up small images to full screen.
 
note
For PostScript output, the size of a pixel may be varied, eliminating the need for zoom, pan, or software re-sampling.
Other displays, including most of those with window systems, have no hardware zoom. On these displays, images must be magnified in software. The REBIN and CONGRID functions provide two ways to magnify or reduce an image to an arbitrary size.
Use REBIN for Integral Multiples (or Factors) of Images
With the REBIN function, the final dimensions must be integral multiples or factors of the original dimensions.
The call to REBIN is:
new_image = REBIN(old_image, cols, rows, /Sample)
where old_image is the array expression to be re-sampled, cols and rows specify the size of the result and are integral multiples or factors of the original dimensions, and the keyword parameter Sample is set to use “nearest neighbor” sampling. If Sample is not set, REBIN uses bi-linear interpolation when magnifying, and neighborhood averaging when reducing. Bi-linear interpolation avoids the “chunky” appearance of magnified pixels but takes more computer time.
For example, to display a 64-by-64 image named area, in a 512-by-512 pixel area using bi-linear interpolation:
TV, REBIN(area, 512, 512)
or without bi-linear interpolation:
TV, REBIN(area, 512, 512, /Sample)
When reducing by a factor of n-by-m, REBIN averages each n-by-m pixel neighborhood. An image may be magnified along one dimension, while at the same time be reduced along the other dimension. For more information on REBIN, see the PV‑WAVE Reference.
CONGRID for Arbitrary Multiples (or Factors) of Images
CONGRID works in a similar fashion, except that the final dimensions can be any arbitrary size. The call to CONGRID using bi-linear interpolation in the resampling algorithm is:
new_image = CONGRID(old_image, cols, rows, /Interp)
where the parameters cols and rows specify the number of columns and rows desired in the output image. If the Interp keyword is not set (i.e., it is equal to 0), the nearest neighbor sampling method is used instead. For more information on CONGRID, see the PV‑WAVE Reference.
The ZOOM Function
There is one other way to magnify an image. On a window system display, the contents of a window (or image) centered about the mouse position can be magnified with the ZOOM procedure. For more information on ZOOM, see the PV‑WAVE Reference.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.