IM_MSB(3)

NAME
 im_msb, im_msb_band - Convert to uchar by discarding bits

SYNOPSIS
#include <vips/vips.h>

int im_msb( IMAGE *in, IMAGE *out );
int im_msb_band( IMAGE *in, IMAGE *out, int band );

DESCRIPTION
im_msb(3) converts char, short, or int images (including LABQ coded ones) into unsigned char images, very quickly, by discarding the lower order bits. Once scaled to char, signed values are converted to unsigned by adding 128.

For a signed short (16 bit) image,

im_msb( in, out );

is equivalent to:

im_lintra( (1.0/256.0), in, 128.0, temp );
im_clip2fmt( temp, out, IM_BANDFMT_UCHAR );

but much faster.

For any image which uses the whole range of values for its band format,

im_msb( in, out );

is equivalent to:

im_scale( in, out );

but a great deal faster, and without evaluating the input twice.

im_msb_band(3) is as im_msb(3), except that all but one of the bands are also discarded.

im_msb_band( in, out, i );

is equivalent to:

im_msb( in, temp );
im_extract_bands( temp, out, i, 1 );

but again, faster.

RETURN VALUE
The functions returns 0 on success and -1 on error.

SEE ALSO
im_lintra(3), im_scale(3), im_clip(3)

COPYRIGHT
Copyright 2006, The Nottingham Trent University.

AUTHOR
Tom Vajzovic