blob: 35e45abc7ec71392624812d332f381ba8dac0132 [file] [log] [blame]
.TH IM_MSB 3 "06 May 2006"
.SH NAME
im_msb, im_msb_band \- Convert to uchar by discarding bits
.SH SYNOPSIS
.nf
.B #include <vips/vips.h>
.sp
.BI "int im_msb( IMAGE " "*in" ", IMAGE " "*out" " );
.br
.BI "int im_msb_band( IMAGE " "*in" ", IMAGE " "*out" ", int " "band" " );
.fi
.SH DESCRIPTION
.B 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.
.PP
For a signed short (16 bit) image,
.PP
im_msb( in, out );
.PP
is equivalent to:
.PP
im_lintra( (1.0/256.0), in, 128.0, temp );
.br
im_clip2fmt( temp, out, IM_BANDFMT_UCHAR );
.PP
but much faster.
.PP
For any image which uses the whole range of values for its band format,
.PP
im_msb( in, out );
.PP
is equivalent to:
.PP
im_scale( in, out );
.PP
but a great deal faster, and without evaluating the input twice.
.PP
.B im_msb_band(3)
is as
.BR im_msb(3) ,
except that all but one of the bands are also discarded.
.PP
im_msb_band( in, out, i );
.PP
is equivalent to:
.PP
im_msb( in, temp );
.br
im_extract_bands( temp, out, i, 1 );
.PP
but again, faster.
.SH RETURN VALUE
The functions returns 0 on success and -1 on error.
.SH SEE ALSO
im_lintra(3), im_scale(3), im_clip(3)
.SH COPYRIGHT
.br
Copyright 2006, The Nottingham Trent University.
.SH AUTHOR
Tom Vajzovic