Vips.Image.buildlut

### Method

# Vips Imagebuildlut

#### Declaration [src]

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

#### Description [src]

This operation builds a lookup table from a set of points. Intermediate values are generated by piecewise linear interpolation. The lookup table is always of type `VIPS_FORMAT_DOUBLE`, use `vips_cast()` to change it to the type you need.

For example, consider this 2 x 2 matrix of (x, y) coordinates:

    2 2
    0   0
    255 100

We then generate a 1 x 256 element LUT like this:

Index | Value
--- | ---
0 | 0
1 | 0.4
etc. | 0.4
255 | 100

This is then written as the output image, with the left column giving the index in the image to place the value.

The (x, y) points don’t need to be sorted: we do that. You can have several Ys, each becomes a band in the output LUT. You don’t need to start at zero, any integer will do, including negatives.

See also

`vips_identity()`, `vips_invertlut()`, `vips_cast()`, `vips_maplut()`.

This method is not directly available to language bindings.

#### Parameters

`out`

  Type: `VipsImage`

  Output image.

  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.