Vips.Image.case

### Method

# Vips Imagecase

#### Declaration [src]

    int
    vips_case (
      VipsImage* index,
      VipsImage** cases,
      VipsImage** out,
      int n,
      ...
    )

#### Description [src]

Use values in `index` to select pixels from `cases`.

`index` must have one band. `cases` can have up to 256 elements. Values in `index` greater than or equal to `n` use the final image in `cases`. The images in `cases` must have either one band or the same number of bands. The output image is the same size as `index`. Images in `cases` are expanded to the smallest common format and number of bands.

Combine this with `vips_switch()` to make something like a case statement or a multi-way `vips_ifthenelse()`.

See also

`vips_maplut()`, `vips_switch()`, `vips_ifthenelse()`.

This method is not directly available to language bindings.

#### Parameters

`cases`

  Type: An array of `VipsImage*`

  Array of case images.

  The length of the array is specified in the `n` argument.
  The data is owned by the caller of the method.

`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.

`n`

  Type: `int`

  Number of case images.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.