VIPS includes a little support for in-place functions — functions which operate directly on an image, both reading and writing from the same descriptor via the data pointer. This is an extremely dangerous way to handle IO, since any bugs in your program will trash your input image.
Operations of this type should call im_rwcheck() instead of im_incheck(). im_rwcheck() tries to get a descriptor ready for in-place writing. For example, a function which cleared an image to black might be written as:
This function might be called from an application as: