IM_HEADER

Section: C Library Functions (3)
Updated: 7 May 2002
Index Return to Main Contents
 

NAME

im_header_int, im_header_double, im_header_string, im_header_get, im_header_get_type, im_header_map - read fields from the image header  

SYNOPSIS

#include <vips/vips.h>

int im_header_int( IMAGE *image, const char *field, int *out )
int im_header_double( IMAGE *image, const char *field, double *out )
int im_header_string( IMAGE *image, const char *field, char **out )
GType im_header_get_type( IMAGE *im, const char *field );
int im_header_get( IMAGE *im, const char *field, GValue *value_copy );
typedef void *(*im_header_map_fn)( IMAGE *,
  const char *, GValue *, void *, void * );
void *im_header_map( IMAGE *im,
  im_header_map_fn fn, void *a, void *b );

 

DESCRIPTION

im_header_int(3) reads the value of an integer header field. These are "Xsize", "Ysize", "Bands", "Bbits", "BandFmt", "Coding", and "Type", or any integer meta field.

im_header_double(3) reads the value of the integer header fields. These are "Xres", and "Yres", or any double meta field.

im_header_string(3) reads the value of the integer header fields. These are "Hist", and "filename" or any string meta field.

im_header_get_type(3) returns the GType (eg. G_TYPE_INT) for a field. It returns zero if the field does not exist. It does not set im_error(3), so it's useful for test for a field's existence.

im_header_get(3) fills the GValue with a copy of the field value, if the field exists. The value should be zeroed but otherwise uninitialised. The value should be unset once the user has finished with it.

im_header_map(3) maps a function over all header fields, presenting the value of each field as a GValue. Return non-NULL from the map function to stop iteration early. It maps over the builtin fields first, then any meta fields.

 

RETURN VALUE

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

SEE ALSO

im_close(3), im_open(3).