im_scale(3) scale an image to unsigned char image

Other Alias



#include <vips/vips.h>

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

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


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.


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