Method
VipsImageifthenelse
Declaration [src]
int
vips_ifthenelse (
VipsImage* cond,
VipsImage* in1,
VipsImage* in2,
VipsImage** out,
...
)
Description [src]
This operation scans the condition image cond
and uses it to select pixels from either the then image in1 or the else
image in2. Non-zero means in1, 0 means in2.
Any image can have either 1 band or n bands, where n is the same for all the non-1-band images. Single band images are then effectively copied to make n-band images.
Images in1 and in2 are cast up to the smallest common format. cond is
cast to uchar.
If the images differ in size, the smaller images are enlarged to match the largest by adding zero pixels along the bottom and right.
If blend is TRUE, then values in out are smoothly blended between in1
and in2 using the formula:
out = (cond / 255) * in1 + (1 - cond / 255) * in2
::: tip “Optional arguments”
* blend: gboolean, blend smoothly between in1 and in2
::: seealso
vips_equal().
Parameters
in1 |
VipsImage |
Then |
|
| The data is owned by the caller of the function. | |
in2 |
VipsImage |
Else |
|
| The data is owned by the caller of the function. | |
out |
VipsImage |
Output |
|
| The argument will be set by the function. | |
| The instance takes ownership of the data, and is responsible for freeing it. | |
... |
none |
|