### Method

# Vips Image invertlut

#### Declaration [src]

    int
    vips_invertlut (
      VipsImage* in,
      VipsImage** out,
      ...
    )

#### Description [src]

Given a mask of target values and real values, generate a LUT which will map reals to targets.

Handy for linearising images from measurements of a colour chart. All values in [0,1]. Piecewise linear interpolation, extrapolate head and tail to 0 and 1.

Eg. input like this:

    4 3
    0.1 0.2 0.3 0.1
    0.2 0.4 0.4 0.2
    0.7 0.5 0.6 0.3

Means a patch with 10% reflectance produces an image with 20% in channel 1, 30% in channel 2, and 10% in channel 3, and so on.

Inputs don’t need to be sorted (we do that). Generate any precision LUT, default to 256 elements.

It won’t work too well for non-monotonic camera responses (we should fix this). Interpolation is simple piecewise linear; we ought to do something better really.

Optional arguments

- `size`: `gint`, generate this much

See also

`vips_buildlut()`.

This method is not directly available to language bindings.

#### Parameters

`out`

  Type: `VipsImage`

  Output LUT.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.