---
name: "im_wrapmany"
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_wrapone"
---

# im\_wrapmany(3)

easy interface to partial image IO system

Part of [im\_wrapone(3)](/im_wrapone/3.md).

## NAME

im\_wrapone, im\_wrapmany - easy interface to partial image IO system

## SYNOPSIS

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

int im\_wrapone( IMAGE \*in, IMAGE \*out, \
     im\_wrapone\_fn fn, void \*a, void \*b )\
 int im\_wrapmany( IMAGE \*\*in, IMAGE \*out, \
     im\_wrapmany\_fn fn, void \*a, void \*b )

where

typedef void (\*im\_wrapone\_fn)( void \*in, void \*out, int n,\
     void \*a, void \*b )\
 typedef void (\*im\_wrapmany\_fn)( void \*\*in, void \*out, int n,\
     void \*a, void \*b )

## DESCRIPTION

These functions provide a simple way to use the VIPS partial image IO system, provided that your image processing function involves no coordinate transformations, that is, that each output PEL depends only upon the corresponding PEL(s) in the input image(s).

You should write your operation as a buffer processing function --- for example:

    static void\
     invert\_buffer( unsigned char \*in, unsigned char \*out, \
         int width )\
     {\
         int x;

        for( x = 0; x \< width; x++ )\
             \*out++ = 255 - \*in++;\
     }

This can now be turned into a full PIO image processing function by:

    int\
     invert( IMAGE \*in, IMAGE \*out )\
     {\
         if( in-\>BandFmt != FMTUCHAR \|\| \
             in-\>Coding != NOCODING \|\|\
             in-\>Bands != 1 ) {\
             im\_errormsg( "invert: bad input" );\
             return( -1 );\
         }\
         if( im\_cp\_desc( out, in ) )\
             return( -1 );\
         if( im\_wrapone( in, out,\
             (im\_wrapone\_fn) invert\_buffer, NULL, NULL ) )\
         return( 0 );\
     }

[im\_wrapmany(3)](/im_wrapmany/3.md) works as [im\_wrapone(3)](/im_wrapone/3.md), but allows many input images. All the inputs should be same Xsize and Ysize, but may vary in type. The array of input images should be NULL-terminated, as for [im\_start\_many(3)](/im_start_many/3.md).

## RETURN VALUE

All int-valued functions return zero on success and non-zero on error.

## COPYRIGHT

National Gallery, 1995

## AUTHOR

J. Cupitt - 9/2/95
