---
name: "im_header_map"
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_header"
---

# im\_header\_map(3)

read fields from the image header

Part of [im\_header(3)](/im_header/3.md).

## 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)](/im_header_int/3.md)** 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)](/im_header_double/3.md)** reads the value of the integer header fields. These are "Xres", and "Yres", or any double meta field.

**[im\_header\_string(3)](/im_header_string/3.md)** reads the value of the integer header fields. These are "Hist", and "filename" or any string meta field.

**[im\_header\_get\_type(3)](/im_header_get_type/3.md)** 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)](/im_error/3.md),** so it's useful for test for a field's existence.

**[im\_header\_get(3)](/im_header_get/3.md)** 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)](/im_header_map/3.md)** 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_close/3.md), [im\_open(3)](/im_open/3.md).
