Vips.Image.max

### Method

# Vips Imagemax

#### Declaration [src]

    int
    vips_max (
      VipsImage* in,
      double* out,
      ...
    )

#### Description [src]

This operation finds the maximum value in an image.

By default it finds the single largest value. If `size` is set >1, it will find the `size` largest values. It will stop searching early if has found enough values. Equal values will be sorted by y then x.

It operates on all bands of the input image: use `vips_stats()` if you need to find an maximum for each band.

For complex images, this operation finds the maximum modulus.

You can read out the position of the maximum with `x` and `y`. You can read out arrays of the values and positions of the top `size` maxima with `out_array`, `x_array` and `y_array`. These values are returned sorted from largest to smallest.

If there are more than `size` maxima, the maxima returned will be a random selection of the maxima in the image.

Optional arguments

- `x`: `gint`, output, horizontal position of maximum
- `y`: `gint`, output, vertical position of maximum
- `size`: `gint`, number of maxima to find
- `out_array`: `VipsArrayDouble`, output, array of maximum values
- `x_array`: `VipsArrayInt`, output, corresponding horizontal positions
- `y_array`: `VipsArrayInt`. output, corresponding vertical positions

See also

`vips_min()`, `vips_stats()`.

This method is not directly available to language bindings.

#### Parameters

`out`

  Type: `double*`

  Output pixel maximum.

  The argument will be set by the function.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.