**Synopsis**

*scaling* or *binning*.

**Scale** submenu to scale the image to the range of display
colors. Any of a variety of linear and non-linear scaling algorithms
can be applied simply by clicking on the appropriate submenu button.
When scaling is performed, the range of image values currently visible
within the area of the display window will be assumed. Limits on the
range of image values and other scaling parameters may be input using
command line switches. For long integer and floating point data,
*SAOimage* uses two stages of scaling, as described below.

**Range of Image Data vs. Size of Color Map**

*SAOimage* typically uses
200 colors to display images.

*COLOR* section for a detailed discussion of color map
manipulation.)

**Basic Scaling Theory**

*SAOimage*
might assign one color map entry (or slot) to each range of six in the
image. Thus values 0 to 5 would be assigned the lowest color map
slot, 0. 6 to 11 would be assigned to 1, and so on up to the values
between 1195 and 1199 going to slot 199 in the color map. Then, if
slot 0 was black, all pixels in the image with data values between 0
and 5 would appear black in the display. If color map slot 131 was
assigned the color pink, then image pixels whose data value was
between 787 and 792 would appear pink in the display.

**Scaling Distributions**

`n` consecutive image value units would map to `m`
color map levels. A log line would be curved, having less slope at
the bottom (more color map values per image value range) and get
steeper toward the top (fewer color map values per image value range).
The square root function would be similar but follow a different
curve.

**Non-linear Distributions**

**Histogram Equalization**

.

**Windowing the Scaling**

**Wrapping the Color Map**

**Realization and Efficiency within SAOimage**

*SAOimage* does not apply its scaling functions to real
data. Where the image data was real, double, or long, the data is
linearly rescaled to integer values between -32767 and 32767 (a range
of 65,535). Each scaling function produces a 65,535 entry lookup
table for this range of values which is used to draw or redraw the
display. If the data has such great extremes that this range linearly
applied to the data's range will be insufficient, windowing limits for
the initial linear scaling can be given on the command line using `
-rmin, -rmax`.

`verbose` mode,
the scaling routine reports the range of values which it finds in the
display.

`-min` and `-max` arguments on the
command line. When `-min` is given, the low end of the range will
not extend below the `-min` value. When `-max` is given, the
upper end will not extend above the `-max` value. Limit value are
given in terms of original file values. The user need not know about
the internally used short integer values. The `-min` and/or `
-max` value can be cleared by giving the `-min` or `-max`
switch with no argument.

**Linear Scaling**

**Wrapped Linear Scaling**

`-wrap` in the *COMMAND LINE* section)

**Log Scaling**

*e**n* from 0 to *X*, where *n* is a
parameter (the default is 10.0) and *X* is determined by *n*
and the two ranges (data and color map). Positive values of *n*
favor the lower data values, while negative values of *n* favor
the higher data values. Values below the minimum are all mapped
to the lowest color map value. Values above the maximum are all mapped to
the highest color map value. (see `-log` in the *COMMAND LINE*
section)

**Square Root Scaling**

*X**(1/n)* from 0 to 1, where *n* is a
parameter (the default is 2.0) and *X* varies from 0 to 1 in steps
determined by the number of color map values. Values of *n*
greater than 1 favor the lower data values, while values of *n*
less than 1 favor the higher data values (negative values and 0 are
not allowed). Values below the minimum are all mapped to the lowest
color map value. Values above the maximum are all mapped to the
highest color map value. (see `-sqrt` in the *COMMAND LINE*
section)

**Histogram Equalization**

*SAOimage* differs from common
one-pass algorithms by accounting for disproportionately large
occurrences of one or a few image values. In an image with 1000
pixels, 500 of which have the value 32, a one-pass algorithm, given
100 colors, will try to get 10 pixels for each color. It will end up
with 49 unused colors, since one color covered 500 pixels. *
SAOimage's* algorithm detects the peak (or peaks) in the histogram
and allocates the remaining 99 colors among the 500 remaining pixels
(5 pixels per color).

**IRAF**

*IRAF* are already scaled to the range
1-200. *IRAF's* own scaling defaults to a windowed linear scaling
where the window is determined by fitting a straight line to a small,
200 pixel, subsampled histogram. Further rescaling within *
SAOimage* is not very useful (see the *IRAF* section).

© Université de Strasbourg/CNRS

• Contact