SUBTRACTION

Section: C Library Functions (3)
Updated: 24 April 1991
Index Return to Main 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