### Function

# Vips Image bandrank

#### Declaration [src]

    int
    vips_bandrank (
      VipsImage** in,
      VipsImage** out,
      int n,
      ...
    )

#### Description [src]

Sorts the images `in` band-element-wise, then outputs an image in which each band element is selected from the sorted list by the `index` parameter. For example, if `index` is zero, then each output band element will be the minimum of all the corresponding input band elements.

By default, `index` is -1, meaning pick the median value.

It works for any uncoded, non-complex image type. Images are cast up to the smallest common-format.

Any image can have either 1 band or n bands, where n is the same for all the non-1-band images. Single band images are then effectively copied to make n-band images.

Smaller input images are expanded by adding black pixels.

Optional arguments

- `index`: `gint`, pick this index from list of sorted values

See also

`vips_rank()`.

This function is not directly available to language bindings.

#### Parameters

`in`

  Type: An array of `VipsImage*`

  Array of input images.

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

`out`

  Type: `VipsImage`

  Output image.

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

`n`

  Type: `int`

  Number of input images.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.