im_extract_bands(3) extract a portion of an image

Other Alias

im_extract_areabands, im_extract_area


#include <vips/vips.h>

int im_extract_areabands( IMAGE *in, IMAGE *out,

  int left, int top, int width, int height, int band, int nbands )

int im_extract_area( IMAGE *in, IMAGE *out,

  int left, int top, int width, int height )

int im_extract_bands( IMAGE *in, IMAGE *out,

  int chsel, int nbands )


im_extract_areabands(3) extracts the rectangular portion of the image defined by left, top, width, and height of image in and writes the result to image out. The area must lie entirely within in the image. Selects the set of nbands bands starting at band number band (numbering bands from zero).

Works for any size image, any number of bands, any type. Works for LABPACK coded images too! But disallows band extraction in this case.

im_extract_area(3) is a convenience function which extracts an area from an image, leaving the bands the same.

im_extract_bands(3) takes nbands out of an image, starting from band band. So, for example, nbands == 2, bands == 1 will form a two band image from an RGB image, where the two bands are the G and the B bands.


The function returns 0 on success and -1 on error.


J. Cupitt,


J. Cupitt - 11/04/1990