---
name: "im_recomb"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.20.7-1+b3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/im_recomb"
---

# im\_recomb(3)

matrix recombination of image

## NAME

im\_recomb - matrix recombination of image

## SYNOPSIS

\#include \<vips/vips.h\>

int im\_recomb(imagein, imageout, mat)\
 IMAGE \*imagein, \*imageout;\
 DOUBLEMASK \*mat;

## DESCRIPTION

im\_recomb() recombines the elements of an m band image to form an n band image using mat, an m by n matrix of floating point numbers.

It calculates

  A = B x C

where A is an n band output image, C is an m band input image and B is an m by n matrix of floats. Can be used with a 3 by 3 matrix to perform simple colour space transforms; 7 by 30 matrix to shrink 3rd order development of 3 filter system to XYZ etc.

The output type is float unless the input type is double, in which case the output type is double. It does not work for complex image types. All intermediates are calculated as double.  Note that the width of the matrix should be equal to the number of bands in the input image.

## RETURN VALUE

The function returns 0 on success and -1 on error.

## SEE ALSO

[im\_read\_dmask(3)](/im_read_dmask/3.md), [im\_matinv(3)](/im_matinv/3.md), [im\_lintra(3)](/im_lintra/3.md)

## COPYRIGHT

National Gallery and Birkbeck College, 1990 - 1996
