---
name: "im_quantim"
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_quantim"
---

# im\_quantim(3)

quantise an image or a lut

## NAME

im\_quantim, im\_quantlut, im\_spatres - quantise an image or a lut

## SYNOPSIS

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

**int im\_quantim(in, out, no\_of\_bits)**\
 **IMAGE \*in, \*out;**\
 **int no\_of\_bits;**

**int im\_quantlut(lut, no\_of\_bits)**\
 **IMAGE \*lut;**\
 **int no\_of\_bits;**

**int im\_spatres(in, out, step)**\
 **IMAGE \*in, \*out;**\
 **int step;**

## DESCRIPTION

**im\_quantim()** quantises the image file held by in using no\_of\_bits and writes the result to out.  The no\_of\_bits should be between 1 and 7 inclusive.  Input can have any number of bands.  The function expects as input a valid unsigned char image.

These functions are here for compatibility only. You should use the boolean operations [im\_andconst(3)](/im_andconst/3.md), [im\_orconst(3)](/im_orconst/3.md), [im\_shrink(3)](/im_shrink/3.md), [im\_zoom(3)](/im_zoom/3.md) and [im\_lowpass(3)](/im_lowpass/3.md).

**im\_quantlut()** creates an one band unsigned char lookup table which is used by [im\_quantim(3)](/im_quantim/3.md).   The no\_of\_bits should be between 1 and 7 inclusive.

**im\_spatres()** reduces the spatial resolution of in by averaging step\*step pixels and replicating the result in out.  The function can be used in order to show the effect of reducing the spatial resolution of a given image and the importance of post-filtering before displaying. Input can have any number of bands.

## RETURN VALUE

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

## SEE ALSO

[im\_andconst(3)](/im_andconst/3.md), [im\_orconst(3)](/im_orconst/3.md), [im\_shrink(3)](/im_shrink/3.md), [im\_zoom(3)](/im_zoom/3.md) [im\_lowpass(3)](/im_lowpass/3.md).

## COPYRIGHT

N. Dessipris

## AUTHOR

N. Dessipris - 10/05/1991
