im_ifthenelse(3) use an unsigned char image to join two images together

SYNOPSIS

#include <vips/vips.h>

int im_ifthenelse(c, a, b, out)
IMAGE *c, *a, *b, *out;

int im_blend(c, a, b, out)
IMAGE *c, *a, *b, *out;

DESCRIPTION

im_ifthenelse builds an output image which uses some pels from a and some from b: if the conditional image c is non-zero at that point, the pel comes from a; if it is zero, the pel comes from b.

The conditional image c can have either 1 band, in which case entire pels come either from a or b, or n bands, where n is the number of bands in both a and b, in which case individual band elements are chosen from a and b.

Images a and b must match in size, type and number of bands.

im_blend(3) works just as im_ifthenelse(3), except that instead of selecting between a and b, values in the condition image are used to softly blend between the two. 255 means a only, 0 means b only, 128 means 50:50.

RETURN VALUE

0 on success and -1 on error.

COPYRIGHT

National Gallery

AUTHOR

J. Cupitt