arithmetic

arithmetic — operations which perform pixel arithmetic, trig, log, statistics

Stability Level

Stable, unless otherwise indicated

Synopsis

#include <vips/vips.h>

enum                VipsOperationBoolean;
enum                VipsOperationComplex;
enum                VipsOperationComplexget;
enum                VipsOperationMath;
enum                VipsOperationMath2;
enum                VipsOperationRelational;
enum                VipsOperationRound;
int                 im_cross_phase                      (VipsImage *a,
                                                         VipsImage *b,
                                                         VipsImage *out);
int                 im_linreg                           (VipsImage **ins,
                                                         VipsImage *out,
                                                         double *xs);
int                 im_maxpos_avg                       (VipsImage *im,
                                                         double *xpos,
                                                         double *ypos,
                                                         double *out);
int                 im_maxpos_vec                       (VipsImage *im,
                                                         int *xpos,
                                                         int *ypos,
                                                         double *maxima,
                                                         int n);
int                 im_minpos_vec                       (VipsImage *im,
                                                         int *xpos,
                                                         int *ypos,
                                                         double *minima,
                                                         int n);
int                 im_point                            (VipsImage *im,
                                                         VipsInterpolate *interpolate,
                                                         double x,
                                                         double y,
                                                         int band,
                                                         double *out);
int                 im_point_bilinear                   (VipsImage *im,
                                                         double x,
                                                         double y,
                                                         int band,
                                                         double *out);
int                 vips_abs                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_acos                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_add                            (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_andimage                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_andimage_const                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_andimage_const1                (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_asin                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_atan                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_avg                            (VipsImage *in,
                                                         double *out,
                                                         ...);
int                 vips_boolean                        (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         VipsOperationBoolean boolean,
                                                         ...);
int                 vips_boolean_const                  (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationBoolean boolean,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_ceil                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_complex                        (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationComplex cmplx,
                                                         ...);
int                 vips_complexform                    (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_complexget                     (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationComplexget get,
                                                         ...);
int                 vips_conj                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_cos                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_deviate                        (VipsImage *in,
                                                         double *out,
                                                         ...);
int                 vips_divide                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_eorimage                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_eorimage_const                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_eorimage_const1                (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_equal                          (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_equal_const                    (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_equal_const1                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_exp                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_exp10                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_floor                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_imag                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_invert                         (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_less                           (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_less_const                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_less_const1                    (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_lesseq                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_lesseq_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_lesseq_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_linear                         (VipsImage *in,
                                                         VipsImage **out,
                                                         double *a,
                                                         double *b,
                                                         int n,
                                                         ...);
int                 vips_linear1                        (VipsImage *in,
                                                         VipsImage **out,
                                                         double a,
                                                         double b,
                                                         ...);
int                 vips_log                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_log10                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_lshift                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_lshift_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_lshift_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_math                           (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationMath math,
                                                         ...);
int                 vips_math2                          (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         VipsOperationMath2 math2,
                                                         ...);
int                 vips_math2_const                    (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationMath2 math2,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_math2_const1                   (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationMath2 math2,
                                                         double c,
                                                         ...);
int                 vips_max                            (VipsImage *in,
                                                         double *out,
                                                         ...);
int                 vips_measure                        (VipsImage *in,
                                                         VipsImage **out,
                                                         int h,
                                                         int v,
                                                         ...);
int                 vips_min                            (VipsImage *in,
                                                         double *out,
                                                         ...);
int                 vips_more                           (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_more_const                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_more_const1                    (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_moreeq                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_moreeq_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_moreeq_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_multiply                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_notequal                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_notequal_const                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_notequal_const1                (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_orimage                        (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_orimage_const                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_orimage_const1                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_polar                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_pow                            (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_pow_const                      (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_pow_const1                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_real                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_rect                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_relational                     (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         VipsOperationRelational relational,
                                                         ...);
int                 vips_relational_const               (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationRelational relational,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_relational_const1              (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationRelational relational,
                                                         double c,
                                                         ...);
int                 vips_remainder                      (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_remainder_const                (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_remainder_const1               (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_rint                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_round                          (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationRound round,
                                                         ...);
int                 vips_rshift                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_rshift_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_rshift_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);
int                 vips_sign                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_sin                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_stats                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_subtract                       (VipsImage *in1,
                                                         VipsImage *in2,
                                                         VipsImage **out,
                                                         ...);
int                 vips_tan                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);
int                 vips_wop                            (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);
int                 vips_wop_const                      (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);
int                 vips_wop_const1                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Object Hierarchy

  GEnum
   +----VipsOperationBoolean
  GEnum
   +----VipsOperationComplex
  GEnum
   +----VipsOperationComplexget
  GEnum
   +----VipsOperationMath
  GEnum
   +----VipsOperationMath2
  GEnum
   +----VipsOperationRelational
  GEnum
   +----VipsOperationRound

Description

These operations perform pixel arithmetic, that is, they perform an arithmetic operation, such as addition, on every pixel in an image or a pair of images. All (except in a few cases noted below) will work with images of any type or any mixture of types, of any size and of any number of bands.

For binary operations, if the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

In the same way, for operations that take an array constant, such as im_remainder_vec(), you can mix single-element arrays or single-band images freely.

Arithmetic operations try to preserve precision by increasing the number of bits in the output image when necessary. Generally, this follows the ANSI C conventions for type promotion, so multiplying two IM_BANDFMT_UCHAR images together, for example, produces a IM_BANDFMT_USHORT image, and taking the im_costra() of a IM_BANDFMT_USHORT image produces IM_BANDFMT_FLOAT image.

For binary arithmetic operations, type promotion occurs in two stages. First, the two input images are cast up to the smallest common format, that is, the type with the smallest range that can represent the full range of both inputs. This conversion can be represented as a table:

Table 1. Smallest common format

in2/in1 uchar char ushort short uint int float double complex double complex
uchar ushort short ushort short uint int float double complex double complex
char short short short short int int float double complex double complex
ushort ushort short ushort short uint int float double complex double complex
short short short short short int int float double complex double complex
uint uint int uint int uint int float double complex double complex
int int int int int int int float double complex double complex
float float float float float float float float double complex double complex
double double double double double double double double double double complex double complex
complex complex complex complex complex complex complex complex double complex complex double complex
double complex double complex double complex double complex double complex double complex double complex double complex double complex double complex double complex


In the second stage, the operation is performed between the two identical types to form the output. The details vary between operations, but generally the principle is that the output type should be large enough to represent the whole rage of possible values, except that int never becomes float.

Details

enum VipsOperationBoolean

typedef enum {
	VIPS_OPERATION_BOOLEAN_AND,
	VIPS_OPERATION_BOOLEAN_OR,
	VIPS_OPERATION_BOOLEAN_EOR,
	VIPS_OPERATION_BOOLEAN_LSHIFT,
	VIPS_OPERATION_BOOLEAN_RSHIFT,
	VIPS_OPERATION_BOOLEAN_LAST
} VipsOperationBoolean;

See also: vips_boolean().

VIPS_OPERATION_BOOLEAN_AND

&

VIPS_OPERATION_BOOLEAN_OR

|

VIPS_OPERATION_BOOLEAN_EOR

^

VIPS_OPERATION_BOOLEAN_LSHIFT

VIPS_OPERATION_BOOLEAN_RSHIFT

VIPS_OPERATION_BOOLEAN_LAST


enum VipsOperationComplex

typedef enum {
	VIPS_OPERATION_COMPLEX_POLAR,
	VIPS_OPERATION_COMPLEX_RECT,
	VIPS_OPERATION_COMPLEX_CONJ,
	VIPS_OPERATION_COMPLEX_LAST
} VipsOperationComplex;

See also: vips_complex().

VIPS_OPERATION_COMPLEX_POLAR

convert to polar coordinates

VIPS_OPERATION_COMPLEX_RECT

convert to rectangular coordinates

VIPS_OPERATION_COMPLEX_CONJ

complex conjugate

VIPS_OPERATION_COMPLEX_LAST


enum VipsOperationComplexget

typedef enum {
	VIPS_OPERATION_COMPLEXGET_REAL,
	VIPS_OPERATION_COMPLEXGET_IMAG,
	VIPS_OPERATION_COMPLEXGET_LAST
} VipsOperationComplexget;

See also: vips_complexget().

VIPS_OPERATION_COMPLEXGET_REAL

get real component

VIPS_OPERATION_COMPLEXGET_IMAG

get imaginary component

VIPS_OPERATION_COMPLEXGET_LAST


enum VipsOperationMath

typedef enum {
	VIPS_OPERATION_MATH_SIN,
	VIPS_OPERATION_MATH_COS,
	VIPS_OPERATION_MATH_TAN,
	VIPS_OPERATION_MATH_ASIN,
	VIPS_OPERATION_MATH_ACOS,
	VIPS_OPERATION_MATH_ATAN,
	VIPS_OPERATION_MATH_LOG,
	VIPS_OPERATION_MATH_LOG10,
	VIPS_OPERATION_MATH_EXP,
	VIPS_OPERATION_MATH_EXP10,
	VIPS_OPERATION_MATH_LAST
} VipsOperationMath;

See also: vips_math().

VIPS_OPERATION_MATH_SIN

sin(), angles in degrees

VIPS_OPERATION_MATH_COS

cos(), angles in degrees

VIPS_OPERATION_MATH_TAN

tan(), angles in degrees

VIPS_OPERATION_MATH_ASIN

asin(), angles in degrees

VIPS_OPERATION_MATH_ACOS

acos(), angles in degrees

VIPS_OPERATION_MATH_ATAN

atan(), angles in degrees

VIPS_OPERATION_MATH_LOG

log base e

VIPS_OPERATION_MATH_LOG10

log base 10

VIPS_OPERATION_MATH_EXP

e to the something

VIPS_OPERATION_MATH_EXP10

10 to the something

VIPS_OPERATION_MATH_LAST


enum VipsOperationMath2

typedef enum {
	VIPS_OPERATION_MATH2_POW,
	VIPS_OPERATION_MATH2_WOP,
	VIPS_OPERATION_MATH2_LAST
} VipsOperationMath2;

See also: vips_math().

VIPS_OPERATION_MATH2_POW

pow( left, right )

VIPS_OPERATION_MATH2_WOP

pow( right, left )

VIPS_OPERATION_MATH2_LAST


enum VipsOperationRelational

typedef enum {
	VIPS_OPERATION_RELATIONAL_EQUAL,
	VIPS_OPERATION_RELATIONAL_NOTEQUAL,
	VIPS_OPERATION_RELATIONAL_LESS,
	VIPS_OPERATION_RELATIONAL_LESSEQ,
	VIPS_OPERATION_RELATIONAL_MORE,
	VIPS_OPERATION_RELATIONAL_MOREEQ,
	VIPS_OPERATION_RELATIONAL_LAST
} VipsOperationRelational;

See also: vips_relational().

VIPS_OPERATION_RELATIONAL_EQUAL

==

VIPS_OPERATION_RELATIONAL_NOTEQUAL

!=

VIPS_OPERATION_RELATIONAL_LESS

<

VIPS_OPERATION_RELATIONAL_LESSEQ

<=

VIPS_OPERATION_RELATIONAL_MORE

>

VIPS_OPERATION_RELATIONAL_MOREEQ

>=

VIPS_OPERATION_RELATIONAL_LAST


enum VipsOperationRound

typedef enum {
	VIPS_OPERATION_ROUND_RINT,
	VIPS_OPERATION_ROUND_CEIL,
	VIPS_OPERATION_ROUND_FLOOR,
	VIPS_OPERATION_ROUND_LAST
} VipsOperationRound;

See also: vips_round().

VIPS_OPERATION_ROUND_RINT

round to nearest

VIPS_OPERATION_ROUND_CEIL

the smallest integral value not less than

VIPS_OPERATION_ROUND_FLOOR

largest integral value not greater than

VIPS_OPERATION_ROUND_LAST


im_cross_phase ()

int                 im_cross_phase                      (VipsImage *a,
                                                         VipsImage *b,
                                                         VipsImage *out);

Find the phase of the cross power spectrum of two complex images, expressed as a complex image where the modulus of each pixel is one.

I.E. find (a.b*)/|a.b*| where . represents complex multiplication * represents the complex conjugate || represents the complex modulus

See also: im_multiply(), im_sign().

a :

input IMAGE 1

b :

input IMAGE 2

out :

output IMAGE

Returns :

0 on success, -1 on error

im_linreg ()

int                 im_linreg                           (VipsImage **ins,
                                                         VipsImage *out,
                                                         double *xs);

Function to find perform pixelwise linear regression on an array of single band images. The output is a seven-band douuble image

TODO: figure out how this works and fix up these docs!

ins :

NULL-terminated array of input images

out :

results of analysis

xs :

X position of each image (pixel value is Y)

im_maxpos_avg ()

int                 im_maxpos_avg                       (VipsImage *im,
                                                         double *xpos,
                                                         double *ypos,
                                                         double *out);

Function to find the maximum of an image. Returns coords and value at double precision. In the event of a draw, returns average of all drawing coords.

See also: im_maxpos(), im_min(), im_stats().

im :

image to scan

xpos :

returned X position

ypos :

returned Y position

out :

returned value

Returns :

0 on success, -1 on error

im_maxpos_vec ()

int                 im_maxpos_vec                       (VipsImage *im,
                                                         int *xpos,
                                                         int *ypos,
                                                         double *maxima,
                                                         int n);

Find the coordinates and values of the n maxima of an image.

For 8 and 16-bit images, it's much faster to find the histogram and then calculate a threshold from that. See im_mpercent().

See also: im_minpos(), im_min(), im_stats(), im_maxpos_avg().

im :

image to scan

xpos :

array to return x positions

ypos :

array to return y positions

maxima :

array to return values

n :

number of maxima to search for

Returns :

0 on success, -1 on error

im_minpos_vec ()

int                 im_minpos_vec                       (VipsImage *im,
                                                         int *xpos,
                                                         int *ypos,
                                                         double *minima,
                                                         int n);

Find the coordinates and values of the n minima of an image.

For 8 and 16-bit images, it's much faster to find the histogram and then calculate a threshold from that. See im_mpercent().

See also: im_minpos(), im_min(), im_stats(), im_maxpos_avg().

im :

image to scan

xpos :

array to return x positions

ypos :

array to return y positions

minima :

array to return values

n :

number of minima to search for

Returns :

0 on success, -1 on error

im_point ()

int                 im_point                            (VipsImage *im,
                                                         VipsInterpolate *interpolate,
                                                         double x,
                                                         double y,
                                                         int band,
                                                         double *out);

Find the value at (x, y) in given band of image. Non-integral values are calculated using the supplied interpolate.

See also: im_avg(), VipsInterpolate

im :

image to read from

interpolate :

interpolator to sample points with

x :

x position to interpolate

y :

y position to interpolate

band :

band to read

out :

return interpolated value

Returns :

0 on success, -1 on error

im_point_bilinear ()

int                 im_point_bilinear                   (VipsImage *im,
                                                         double x,
                                                         double y,
                                                         int band,
                                                         double *out);

Find the value at (x,y) in given band of image. Use bilinear interpolation if x or y are non-integral.

See also: im_avg(), im_point().

im :

image to read from

x :

x position to interpolate

y :

y position to interpolate

band :

band to read

out :

return interpolated value

Returns :

0 on success, -1 on error

vips_abs ()

int                 vips_abs                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

This operation finds the absolute value of an image. It does a copy for unsigned integer types, negate for negative values in signed integer types, fabs(3) for float types, and calculates modulus for complex types.

See also: vips_sign().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_acos ()

int                 vips_acos                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_ACOS on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_add ()

int                 vips_add                            (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

This operation calculates in1 + in2 and writes the result to out.

If the images differ in size, the smaller image is enlarged to match the larger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

The two input images are cast up to the smallest common type (see table Smallest common format in arithmetic), then the following table is used to determine the output type:

Table 2. VipsAdd type promotion

input type output type
uchar ushort
char short
ushort uint
short int
uint uint
int int
float float
double double
complex complex
double complex double complex


In other words, the output type is just large enough to hold the whole range of possible values.

Operations on integer images are performed using the processor's vector unit, if possible. Disable this with --vips-novector or IM_NOVECTOR.

See also: vips_subtract(), vips_linear().

left :

input image

right :

input image

out :

output image

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_andimage ()

int                 vips_andimage                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_AND on a pair of images. See vips_boolean().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_andimage_const ()

int                 vips_andimage_const                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_AND on an image and an array of constants. See vips_boolean_const().

See also: vips_boolean(), vips_boolean_const1().

in :

input image

out :

output image

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_andimage_const1 ()

int                 vips_andimage_const1                (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_AND on an image and a constant. See vips_boolean_const1().

See also: vips_boolean(), vips_boolean_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_asin ()

int                 vips_asin                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_ASIN on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_atan ()

int                 vips_atan                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_ATAN on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_avg ()

int                 vips_avg                            (VipsImage *in,
                                                         double *out,
                                                         ...);

This operation finds the average value in an image. It operates on all bands of the input image: use vips_stats() if you need to calculate an average for each band. For complex images, return the average modulus.

See also: vips_stats(), vips_bandmean(), vips_deviate(), vips_rank()

in :

input VipsImage

out :

output pixel average

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_boolean ()

int                 vips_boolean                        (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         VipsOperationBoolean boolean,
                                                         ...);

Perform various boolean operations on pairs of images.

The output image is the same format as the upcast input images for integer types. Float types are cast to int before processing. Complex types are not supported.

If the images differ in size, the smaller image is enlarged to match the larger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

The two input images are cast up to the smallest common type (see table Smallest common format in arithmetic).

See also: vips_boolean_const().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

boolean :

boolean operation to perform

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_boolean_const ()

int                 vips_boolean_const                  (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationBoolean boolean,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform various boolean operations on an image against an array of constants.

The output type is always uchar, with 0 for FALSE and 255 for TRUE.

If the array of constants has just one element, that constant is used for all image bands. If the array has more than one element and they have the same number of elements as there are bands in the image, then one array element is used for each band. If the arrays have more than one element and the image only has a single band, the result is a many-band image where each band corresponds to one array element.

See also: vips_boolean(), vips_boolean_const1().

in :

input image

out :

output image

boolean :

boolean operation to perform

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_ceil ()

int                 vips_ceil                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Round to an integral value with VIPS_OPERATION_ROUND_CEIL. See vips_round().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_complex ()

int                 vips_complex                        (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationComplex cmplx,
                                                         ...);

Perform various operations on complex images.

Angles are expressed in degrees. The output type is complex unless the input is double or dpcomplex, in which case the output is dpcomplex.

in :

input VipsImage

out :

output VipsImage

cmplx :

complex operation to perform

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_complexform ()

int                 vips_complexform                    (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Compose two real images to make a complex image. If either left or right are VIPS_FORMAT_DOUBLE, out is VIPS_FORMAT_DPCOMPLEX. Otherwise out is VIPS_FORMAT_COMPLEX. left becomes the real component of out and right the imaginary.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

See also: vips_complexget().

left :

input image

right :

input image

out :

output image

Returns :

0 on success, -1 on error

vips_complexget ()

int                 vips_complexget                     (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationComplexget get,
                                                         ...);

Get components of complex images.

The output type is the same as the input type, except VIPS_FORMAT_COMPLEX becomes VIPS_FORMAT_FLOAT and VIPS_FORMAT_DPCOMPLEX becomes VIPS_FORMAT_DOUBLE.

in :

input VipsImage

out :

output VipsImage

get :

complex operation to perform

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_conj ()

int                 vips_conj                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_COMPLEX_CONJ on an image. See vips_complex().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_cos ()

int                 vips_cos                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_COS on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_deviate ()

int                 vips_deviate                        (VipsImage *in,
                                                         double *out,
                                                         ...);

vips_divide ()

int                 vips_divide                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

vips_eorimage ()

int                 vips_eorimage                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_EOR on a pair of images. See vips_boolean().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_eorimage_const ()

int                 vips_eorimage_const                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_EOR on an image and an array of constants. See vips_boolean_const().

See also: vips_boolean(), vips_boolean_const1().

in :

input image

out :

output image

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_eorimage_const1 ()

int                 vips_eorimage_const1                (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_EOR on an image and a constant. See vips_boolean_const1().

See also: vips_boolean(), vips_boolean_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_equal ()

int                 vips_equal                          (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_EQUAL on a pair of images. See vips_relational().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_equal_const ()

int                 vips_equal_const                    (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. See vips_relational_const().

in :

input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_equal_const1 ()

int                 vips_equal_const1                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_EQUAL on an image and a constant. See vips_relational_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_exp ()

int                 vips_exp                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_EXP on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_exp10 ()

int                 vips_exp10                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_EXP10 on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_floor ()

int                 vips_floor                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Round to an integral value with VIPS_OPERATION_ROUND_FLOOR. See vips_round().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_imag ()

int                 vips_imag                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_COMPLEXGET_IMAG on an image. See vips_complexget().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_invert ()

int                 vips_invert                         (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

For unsigned formats, this operation calculates (max - in), eg. (255 - in) for uchar. For signed and float formats, this operation calculates (-1 * in).

See also: vips_linear().

in :

input image

out :

output image

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_less ()

int                 vips_less                           (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_LESS on a pair of images. See vips_relational().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_less_const ()

int                 vips_less_const                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_LESS on an image and a constant. See vips_relational_const().

in :

input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_less_const1 ()

int                 vips_less_const1                    (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_LESS on an image and a constant. See vips_relational_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_lesseq ()

int                 vips_lesseq                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_LESSEQ on a pair of images. See vips_relational().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_lesseq_const ()

int                 vips_lesseq_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. See vips_relational_const().

in :

input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_lesseq_const1 ()

int                 vips_lesseq_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_LESSEQ on an image and a constant. See vips_relational_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_linear ()

int                 vips_linear                         (VipsImage *in,
                                                         VipsImage **out,
                                                         double *a,
                                                         double *b,
                                                         int n,
                                                         ...);

Pass an image through a linear transform, ie. (out = in * a + b). Output is always float for integer input, double for double input, complex for complex input and double complex for double complex input.

If the arrays of constants have just one element, that constant is used for all image bands. If the arrays have more than one element and they have the same number of elements as there are bands in the image, then one array element is used for each band. If the arrays have more than one element and the image only has a single band, the result is a many-band image where each band corresponds to one array element.

See also: vips_linear1(), vips_add().

in :

image to transform

out :

output image

a :

array of constants for multiplication

b :

array of constants for addition

n :

length of constant arrays

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_linear1 ()

int                 vips_linear1                        (VipsImage *in,
                                                         VipsImage **out,
                                                         double a,
                                                         double b,
                                                         ...);

Run vips_linear() with a single constant.

See also: vips_linear().

in :

image to transform

out :

output image

a :

constant for multiplication

b :

constant for addition

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_log ()

int                 vips_log                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_LOG on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_log10 ()

int                 vips_log10                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_LOG10 on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_lshift ()

int                 vips_lshift                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_LSHIFT on a pair of images. See vips_boolean().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_lshift_const ()

int                 vips_lshift_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_LSHIFT on an image and an array of constants. See vips_boolean_const().

See also: vips_boolean(), vips_boolean_const1().

in :

input image

out :

output image

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_lshift_const1 ()

int                 vips_lshift_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_LSHIFT on an image and a constant. See vips_boolean_const1().

See also: vips_boolean(), vips_boolean_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_math ()

int                 vips_math                           (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationMath math,
                                                         ...);

Perform various functions in -lm, the maths library, on images.

Angles are expressed in degrees. The output type is float unless the input is double, in which case the output is double.

Non-complex images only.

See also: vips_math2().

in :

input VipsImage

out :

output VipsImage

math :

math operation to perform

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_math2 ()

int                 vips_math2                          (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         VipsOperationMath2 math2,
                                                         ...);

This operation calculates a 2-ary maths operation on a pair of images and writes the result to out. The images may have any non-complex format. out is float except in the case that either of left or right are double, in which case out is also double.

It detects division by zero, setting those pixels to zero in the output. Beware: it does this silently!

If the images differ in size, the smaller image is enlarged to match the larger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

The two input images are cast up to the smallest common type (see table Smallest common format in arithmetic), and that format is the result type.

See also: vips_math2_const().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

math2 :

math operation to perform

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_math2_const ()

int                 vips_math2_const                    (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationMath2 math2,
                                                         double *c,
                                                         int n,
                                                         ...);

This operation calculates various 2-ary maths operations on an image and an array of constants and writes the result to out. The image may have any non-complex format. out is float except in the case that in is double, in which case out is also double.

It detects division by zero, setting those pixels to zero in the output. Beware: it does this silently!

If the array of constants has just one element, that constant is used for all image bands. If the array has more than one element and they have the same number of elements as there are bands in the image, then one array element is used for each band. If the arrays have more than one element and the image only has a single band, the result is a many-band image where each band corresponds to one array element.

See also: vips_math2(), vips_math().

in :

input image

out :

output image

math2 :

math operation to perform

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_math2_const1 ()

int                 vips_math2_const1                   (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationMath2 math2,
                                                         double c,
                                                         ...);

This operation calculates various 2-ary maths operations on an image and a constant. See vips_math2_const().

in :

input image

out :

output image

math2 :

math operation to perform

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_max ()

int                 vips_max                            (VipsImage *in,
                                                         double *out,
                                                         ...);

Optional arguments:

x: horizontal position of maximum y: vertical position of maximum

This operation finds the maximum value in an image.

If the image contains several maximum values, only the first one found is returned.

It operates on all bands of the input image: use vips_stats() if you need to find an maximum for each band.

For complex images, this operation finds the maximum modulus.

See also: vips_min(), vips_stats().

in :

input VipsImage

out :

output pixel maximum

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_measure ()

int                 vips_measure                        (VipsImage *in,
                                                         VipsImage **out,
                                                         int h,
                                                         int v,
                                                         ...);

Optional arguments:

left: area of image containing chart top: area of image containing chart width: area of image containing chart height: area of image containing chart

Analyse a grid of colour patches, producing an array of patch averages. The mask has a row for each measured patch and a column for each image band. The operations issues a warning if any patch has a deviation more than 20% of the mean. Only the central 50% of each patch is averaged.

If the chart does not fill the whole image, use the optional left, top, width, height arguments to indicate the position of the chart.

See also: vips_avg(), vips_deviate().

im :

image to measure

out :

array of measurements

h :

patches across chart

v :

patches down chart

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_min ()

int                 vips_min                            (VipsImage *in,
                                                         double *out,
                                                         ...);

Optional arguments:

x: horizontal position of minimum y: vertical position of minimum

This operation finds the minimum value in an image.

If the image contains several minimum values, only the first one found is returned.

It operates on all bands of the input image: use vips_stats() if you need to find an minimum for each band.

For complex images, this operation finds the minimum modulus.

See also: vips_max(), vips_stats().

in :

input VipsImage

out :

output pixel maximum

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_more ()

int                 vips_more                           (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_MORE on a pair of images. See vips_relational().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_more_const ()

int                 vips_more_const                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_MORE on an image and a constant. See vips_relational_const().

in :

input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_more_const1 ()

int                 vips_more_const1                    (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_MORE on an image and a constant. See vips_relational_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_moreeq ()

int                 vips_moreeq                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_MOREEQ on a pair of images. See vips_relational().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_moreeq_const ()

int                 vips_moreeq_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. See vips_relational_const().

in :

input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_moreeq_const1 ()

int                 vips_moreeq_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_MOREEQ on an image and a constant. See vips_relational_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_multiply ()

int                 vips_multiply                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

This operation calculates left * right and writes the result to out.

If the images differ in size, the smaller image is enlarged to match the larger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

The two input images are cast up to the smallest common type (see table Smallest common format in arithmetic), then the following table is used to determine the output type:

Table 3. VipsMultiply type promotion

input type output type
uchar ushort
char short
ushort uint
short int
uint uint
int int
float float
double double
complex complex
double complex double complex


In other words, the output type is just large enough to hold the whole range of possible values.

See also: vips_add(), vips_linear().

left :

left-hand image

right :

right-hand image

out :

output image

Returns :

0 on success, -1 on error

vips_notequal ()

int                 vips_notequal                       (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_NOTEQUAL on a pair of images. See vips_relational().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_notequal_const ()

int                 vips_notequal_const                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_NOTEQUAL on an image and a constant. See vips_relational_const().

in :

input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_notequal_const1 ()

int                 vips_notequal_const1                (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_RELATIONAL_NOTEQUAL on an image and a constant. See vips_relational_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_orimage ()

int                 vips_orimage                        (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_OR on a pair of images. See vips_boolean().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_orimage_const ()

int                 vips_orimage_const                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_OR on an image and an array of constants. See vips_boolean_const().

See also: vips_boolean(), vips_boolean_const1().

in :

input image

out :

output image

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_orimage_const1 ()

int                 vips_orimage_const1                 (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_OR on an image and a constant. See vips_boolean_const1().

See also: vips_boolean(), vips_boolean_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_polar ()

int                 vips_polar                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_COMPLEX_POLAR on an image. See vips_complex().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_pow ()

int                 vips_pow                            (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH2_POW on a pair of images. See vips_math2().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_pow_const ()

int                 vips_pow_const                      (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_MATH2_POW on an image and a constant. See vips_math2_const().

in :

left-hand input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_pow_const1 ()

int                 vips_pow_const1                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_MATH2_POW on an image and a constant. See vips_math2_const().

in :

left-hand input VipsImage

out :

output VipsImage

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_real ()

int                 vips_real                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_COMPLEXGET_REAL on an image. See vips_complexget().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_rect ()

int                 vips_rect                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_COMPLEX_RECT on an image. See vips_complex().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_relational ()

int                 vips_relational                     (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         VipsOperationRelational relational,
                                                         ...);

Perform various relational operations on pairs of images.

The output type is always uchar, with 0 for FALSE and 255 for TRUE.

Less-than and greater-than for complex images compare the modulus.

If the images differ in size, the smaller image is enlarged to match the larger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

The two input images are cast up to the smallest common type (see table Smallest common format in arithmetic).

See also: vips_boolean(), vips_relational_const().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

relational :

relational operation to perform

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_relational_const ()

int                 vips_relational_const               (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationRelational relational,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform various relational operations on an image and an array of constants.

The output type is always uchar, with 0 for FALSE and 255 for TRUE.

If the array of constants has just one element, that constant is used for all image bands. If the array has more than one element and they have the same number of elements as there are bands in the image, then one array element is used for each band. If the arrays have more than one element and the image only has a single band, the result is a many-band image where each band corresponds to one array element.

See also: vips_boolean(), vips_relational().

in :

input image

out :

output image

relational :

relational operation to perform

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_relational_const1 ()

int                 vips_relational_const1              (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationRelational relational,
                                                         double c,
                                                         ...);

Perform various relational operations on an image and a constant. See vips_relational_const().

See also: vips_boolean(), vips_relational().

in :

input image

out :

output image

relational :

relational operation to perform

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_remainder ()

int                 vips_remainder                      (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

This operation calculates left % right (remainder after integer division) and writes the result to out. The images may have any non-complex format. For float formats, vips_remainder() calculates in1 - in2 * floor (in1 / in2).

If the images differ in size, the smaller image is enlarged to match the larger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

The two input images are cast up to the smallest common type (see table Smallest common format in arithmetic), and that format is the result type.

See also: vips_remainder_const(), vips_divide(), vips_round().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_remainder_const ()

int                 vips_remainder_const                (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

This operation calculates in % c (remainder after division by an array of constants) and writes the result to out. The image may have any non-complex format. For float formats, vips_remainder_const() calculates in - c * floor (in / c).

If the array of constants has just one element, that constant is used for all image bands. If the array has more than one element and they have the same number of elements as there are bands in the image, then one array element is used for each band. If the arrays have more than one element and the image only has a single band, the result is a many-band image where each band corresponds to one array element.

See also: vips_remainder(), vips_divide(), vips_round().

in :

input image

out :

output image

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_remainder_const1 ()

int                 vips_remainder_const1               (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

This operation calculates in % c (remainder after division by a constant) and writes the result to out. The image may have any non-complex format. For float formats, vips_remainder_const() calculates in - c * floor (in / c).

If the array of constants has just one element, that constant is used for all image bands. If the array has more than one element and they have the same number of elements as there are bands in the image, then one array element is used for each band. If the arrays have more than one element and the image only has a single band, the result is a many-band image where each band corresponds to one array element.

See also: vips_remainder(), vips_divide(), vips_round().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_rint ()

int                 vips_rint                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Round to an integral value with VIPS_OPERATION_ROUND_RINT. See vips_round().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_round ()

int                 vips_round                          (VipsImage *in,
                                                         VipsImage **out,
                                                         VipsOperationRound round,
                                                         ...);

Round to an integral value.

Copy for integer types, round float and complex types.

The format of out is always the same as in, so you may wish to cast to an integer format afterwards.

See also: vips_cast()

in :

input VipsImage

out :

output VipsImage

round :

VipsOperationRound rounding operation to perform

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_rshift ()

int                 vips_rshift                         (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_RSHIFT on a pair of images. See vips_boolean().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_rshift_const ()

int                 vips_rshift_const                   (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_LSHIFT on an image and an array of constants. See vips_boolean_const().

See also: vips_boolean(), vips_boolean_const1().

in :

input image

out :

output image

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_rshift_const1 ()

int                 vips_rshift_const1                  (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_BOOLEAN_RSHIFT on an image and a constant. See vips_boolean_const1().

See also: vips_boolean(), vips_boolean_const().

in :

input image

out :

output image

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_sign ()

int                 vips_sign                           (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Finds the unit vector in the direction of the pixel value. For non-complex images, it returns a signed char image with values -1, 0, and 1 for negative, zero and positive pixels. For complex images, it returns a complex normalised to length 1.

See also: vips_abs().

in :

input image

out :

output image

Returns :

0 on success, -1 on error

vips_sin ()

int                 vips_sin                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_SIN on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_stats ()

int                 vips_stats                          (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Find many image statistics in a single pass through the data. out is a one-band VIPS_FORMAT_DOUBLE image of at least 10 columns by n + 1 (where n is number of bands in image in) rows. Columns are statistics, and are, in order: minimum, maximum, sum, sum of squares, mean, standard deviation, x coordinate of minimum, y coordinate of minimum, x coordinate of maximum, y coordinate of maximum. Later versions of vips_stats() may add more columns.

Row 0 has statistics for all bands together, row 1 has stats for band 1, and so on.

See also: vips_avg(), vips_min().

in :

image to scan

out :

image of statistics

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_subtract ()

int                 vips_subtract                       (VipsImage *in1,
                                                         VipsImage *in2,
                                                         VipsImage **out,
                                                         ...);

This operation calculates in1 - in2 and writes the result to out.

If the images differ in size, the smaller image is enlarged to match the larger by adding zero pixels along the bottom and right.

If the number of bands differs, one of the images must have one band. In this case, an n-band image is formed from the one-band image by joining n copies of the one-band image together, and then the two n-band images are operated upon.

The two input images are cast up to the smallest common type (see table Smallest common format in arithmetic), then the following table is used to determine the output type:

Table 4. VipsSubtract type promotion

input type output type
uchar short
char short
ushort int
short int
uint int
int int
float float
double double
complex complex
double complex double complex


In other words, the output type is just large enough to hold the whole range of possible values.

See also: vips_add(), vips_linear().

in1 :

input image

in2 :

input image

out :

output image

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_tan ()

int                 vips_tan                            (VipsImage *in,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH_TAN on an image. See vips_math().

in :

input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_wop ()

int                 vips_wop                            (VipsImage *left,
                                                         VipsImage *right,
                                                         VipsImage **out,
                                                         ...);

Perform VIPS_OPERATION_MATH2_WOP on a pair of images. See vips_math2().

left :

left-hand input VipsImage

right :

right-hand input VipsImage

out :

output VipsImage

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_wop_const ()

int                 vips_wop_const                      (VipsImage *in,
                                                         VipsImage **out,
                                                         double *c,
                                                         int n,
                                                         ...);

Perform VIPS_OPERATION_MATH2_WOP on an image and a constant. See vips_math2_const().

in :

left-hand input VipsImage

out :

output VipsImage

c :

array of constants

n :

number of constants in c

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

vips_wop_const1 ()

int                 vips_wop_const1                     (VipsImage *in,
                                                         VipsImage **out,
                                                         double c,
                                                         ...);

Perform VIPS_OPERATION_MATH2_WOP on an image and a constant. See vips_math2_const().

in :

left-hand input VipsImage

out :

output VipsImage

c :

constant

... :

NULL-terminated list of optional named arguments

Returns :

0 on success, -1 on error

See Also

boolean