CONVERSIONS

Section: C Library Functions (3)
Updated: 28 June 1990
Index Return to Main Contents
 

NAME

im_scale, im_scaleps - scale an image to unsigned char image  

SYNOPSIS

#include <vips/vips.h>

int im_scale(in, out)
IMAGE *in, *out;

int im_scaleps(in, out)
IMAGE *in, *out;  

DESCRIPTION

These functions scale a non-complex image to a displayable byte (unsigned char) image.

im_scale() scales the image held by image descriptor to a byte (unsigned char) image and writes the result on the image descriptor out. Sizes and the number of the bands of out are identical to those of input. Input image should be non complex and can have any number of channels. The output is scaled between 0 and 255; if the image is multiband the maximum value of all channels is set to 255 and the minimum to 0. In all cases, rounding is performed by adding .5 to the scaled values.

im_scaleps() scales to 0 - 255 by mapping each pixel through the equation


   log10(1.0 + pow(x, 0.25))

and then multiplying by a factor so that the image maximum is 255.

This transformation highlights both low and high spatial frequencies in the power spectrum. The images produced by this non-linear transformation are only for display and not for further processing.  

RETURN VALUE

Each function returns 0 on success and -1 on error.  

SEE ALSO

im_any2c(3), im_c2amph(3), im_clip(3)