Table of Contents

## Name

im_subtract - subtracts two images

## Synopsis

#include <vips/vips.h>

int im_subtract(in1, in2, out)
IMAGE *in1, *in2, *out;

## Description

This functions calculates in1 - in2 and writes the result in the image descriptor out. Input images in1 and in2 should have the same channels and the same sizes; however they can be of different types. Only the history of the image descriptor pointed by in1 is copied to out.

The type of the output is given by the table:

in1 - uchar char ushort short uint int
-------|-----------------------------------------
in2 |
uchar | short short short short int int
char | short short short short int int
ushort | short short short short int int
short | short short short short int int
uint | int int int int int int
int | int int int int int int

The result of this operation cannot be unsigned. For float types, the refult is float unless one of the inputs is double, in which case the result is double. For complex types the result is FMTCOMPLEX, unless one of the inputs is FMTDPCOMPLEX, in which case the output is FMTDPCOMPLEX.

## Bugs

None of the functions checks the result for over/underflow.

## Return Value

All functions return 0 on success and -1 on error.

## See Also

im_add(3) , im_lintra(3) , im_multiply(3) .

## Copyright

National Gallery, 1995

Table of Contents

- Name
- Synopsis
- Description
- Bugs
- Return Value
- See Also
- Copyright