These callbacks are invoked just before an image is closed. They are useful for freeing objects which are associated with the image. All callbacks are triggered in the reverse order to the order in which they were attached. This is sometimes important when freeing objects which contain pointers to other objects.
Use im_add_close_callback()
to add a close callback:
int im_add_close_callback( IMAGE *im, int (*callback)(), void *a, void *b )
where callback()
is a function supplied by you which has type:
int callback( void *a, void *b )
and which returns 0 on success, and -1 on error, setting
im_error()
. As with im_generate()
, the values a
and b
are carried around for you by VIPS, and may be used as your
function sees fit.