---
name: "im_max"
section: "3"
platform: "linux"
package: "libvips-dev"
version: "7.20.7-1+b3"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/im_avg"
---

# im\_max(3)

find the mean, standard deviation, minimum and maximum of an image

Part of [im\_avg(3)](/im_avg/3.md).

## NAME

im\_avg, im\_deviate, im\_min, im\_minpos, im\_max, im\_maxpos - find the mean, standard deviation, minimum and maximum of an image

## SYNOPSIS

**#include \<vips/vips.h\>**

**int im\_avg(im, out)**\
 **IMAGE \*im;**\
 **double \*out;**

**int im\_deviate(im, out)**\
 **IMAGE \*im;**\
 **double \*out;**

**int im\_min(im, out)**\
 **IMAGE \*im;**\
 **double \*out;**

**int im\_minpos(im, xpos, ypos, min)**\
 **IMAGE \*im;**\
 **int \*xpos, \*ypos;**\
 **double \*min;**

**int im\_max(im, out)**\
 **IMAGE \*im;**\
 **double \*out;**

**int im\_maxpos(im, xpos, ypos, max)**\
 **IMAGE \*im;**\
 **int \*xpos, \*ypos;**\
 **double \*max;**

## DESCRIPTION

These functions find the mean, standard deviation, minimum, maximum of an image. They operate on all bands of the input image. Use **[im\_stats(3)](/im_stats/3.md)** if you need to calculate on bands separately. All computations are carried out in  double precision arithmetic. The standard deviation is calculated using the formula:

 Var{E} = 1 / (N - 1) \* (E{X^2} - E{X}^2 / N)\
  stdev{E} = sqrt(Var{E}).

**[im\_avg(3)](/im_avg/3.md)** finds the average of an image pointed by im.  Takes as input any non-complex image format and returns a double at the location pointed by out.

**[im\_deviate(3)](/im_deviate/3.md)** finds the standard deviation of an image pointed by im.  Takes as  input any non-complex image format and returns a double at the location pointed by out.

**[im\_min(3)](/im_min/3.md)** finds the the minimum value of the image pointed by im and returns it at the location pointed by out.  Takes as  input any image format and returns a double at the location pointed by out.  If input is complex  the min square amplitude (re\*re+im\*im) is returned.

**[im\_minpos(3)](/im_minpos/3.md)** finds the the minimum value of the image pointed by im and returns it at the location pointed by out.  The coordinates of the last occurrence of  min is returned at locations pointed by xpos, ypos.  If input is complex the min square amplitude (re\*re+im\*im) is returned.

**[im\_max(3)](/im_max/3.md)** finds the the maximum value of the image pointed by im and returns it at the location pointed by out.  If input is complex  the max square amplitude (re\*re+im\*im) is returned.

**[im\_maxpos(3)](/im_maxpos/3.md)** finds the the maximum value of the image pointed by im and returns it at the location pointed by max.  The coordinates of the last occurrence of  max is returned at locations pointed by xpos, ypos.  If input is complex  the max square amplitude (re\*re+im\*im) and its last occurrence is returned.

## RETURN VALUE

All functions return 0 on success and -1 on error.

## SEE ALSO

[im\_exptra(3)](/im_exptra/3.md), [im\_lintra(3)](/im_lintra/3.md), [im\_abs(3)](/im_abs/3.md), [im\_stats(3)](/im_stats/3.md).

## COPYRIGHT

N. Dessipris

## AUTHOR

N. Dessipris - 24/04/1991\
 J. Cupitt - 21/7/93
