Vips.Image.maplut

### Method

# Vips Imagemaplut

#### Declaration [src]

    int
    vips_maplut (
      VipsImage* in,
      VipsImage** out,
      VipsImage* lut,
      ...
    )

#### Description [src]

Map an image through another image acting as a LUT (Look Up Table). The lut may have any type and the output image will be that type.

The input image will be cast to one of the unsigned integer types, that is, `VIPS_FORMAT_UCHAR`, `VIPS_FORMAT_USHORT` or `VIPS_FORMAT_UINT`.

If `lut` is too small for the input type (for example, if `in` is `VIPS_FORMAT_UCHAR` but `lut` only has 100 elements), the lut is padded out by copying the last element. Overflows are reported at the end of computation. If `lut` is too large, extra values are ignored.

If `lut` has one band and `band` is -1 (the default), then all bands of `in` pass through `lut`. If `band` is >= 0, then just that band of `in` passes through `lut` and other bands are just copied.

If `lut` has same number of bands as `in`, then each band is mapped separately. If `in` has one band, then `lut` may have many bands and the output will have the same number of bands as `lut`.

Optional arguments

- `band`: `gint`, apply one-band `lut` to this band of `in`

See also

`vips_hist_find()`, `vips_identity()`.

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.

`lut`

  Type: `VipsImage`

  Look-up table.

  The data is owned by the caller of the method.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.