libvips supports getting and setting image header data (including metadata)in a uniform way.
Usevips_image_get_typeof()
to test for the existence andGType
of a header field.
You can attach arbitrary metadata to images. Metadata is copied as imagesare processed, so all images which used this image as input, directly orindirectly, will have this same bit of metadata attached to them. Copyingis implemented with reference-counted pointers, so it is efficient, even forlarge items of data. This does however mean that metadata items need to beimmutable. Metadata is handy for things likeICC profiles orEXIF data.
Various convenience functions (e.g.vips_image_set_int()
) let you easilyattach simple types like numbers, strings and memory blocks to images.Usevips_image_map()
to loop over an image’s fields, including all metadata.
Items of metadata are identified by strings. Some strings are reserved, forexample theICC profile for an image is known by convention as“icc-profile-data” (i.e. theVIPS_META_ICC_NAME
constant).
If you save an image in.v
format, all metadata (with a restriction, seebelow) is automatically saved for you in a block ofXML at the end of thefile. When you load a.v
image, the metadata is restored. You can use thevipsedit
command-line tool to extract or replace this block ofXML.
.v
metadata is based onGValue
. See the docs for thatsystem if you want to do fancy stuff such as defining a new metadata type.libvips defines a newGValue
calledVipsSaveString
, avariety of string, seevips_value_set_save_string()
. If yourGValue
can be transformed toVipsSaveString
, it willbe saved and loaded to and from.v
files for you.
libvips provides a couple of base classes which implement reference-countedareas of memory. If you base your metadata on one of these types, it can becopied between images efficiently.
vips_format_sizeof()
vips_format_sizeof_unsafe()
vips_interpretation_max_alpha()
vips_image_get_width()
vips_image_get_height()
vips_image_get_bands()
vips_image_get_format()
vips_image_get_format_max()
vips_image_guess_format()
vips_image_get_coding()
vips_image_get_interpretation()
vips_image_guess_interpretation()
vips_image_get_xres()
vips_image_get_yres()
vips_image_get_xoffset()
vips_image_get_yoffset()
vips_image_get_filename()
vips_image_get_mode()
vips_image_get_scale()
vips_image_get_offset()
vips_image_get_page_height()
vips_image_get_n_pages()
vips_image_get_n_subifds()
vips_image_get_orientation()
vips_image_get_orientation_swap()
vips_image_get_concurrency()
vips_image_get_data()
vips_image_init_fields()
vips_image_set()
vips_image_get()
vips_image_get_as_string()
vips_image_get_typeof()
vips_image_remove()
vips_image_map()
vips_image_get_fields()
vips_image_set_area()
vips_image_get_area()
vips_image_set_blob()
vips_image_set_blob_copy()
vips_image_get_blob()
vips_image_get_int()
vips_image_set_int()
vips_image_get_double()
vips_image_set_double()
vips_image_get_string()
vips_image_set_string()
vips_image_print_field()
vips_image_get_image()
vips_image_set_image()
vips_image_set_array_int()
vips_image_get_array_int()
vips_image_get_array_double()
vips_image_set_array_double()
vips_image_history_printf()
vips_image_history_args()
vips_image_get_history()
VIPS_META_EXIF_NAME
VIPS_META_XMP_NAME
VIPS_META_IPTC_NAME
VIPS_META_PHOTOSHOP_NAME
VIPS_META_ICC_NAME
VIPS_META_IMAGEDESCRIPTION
VIPS_META_RESOLUTION_UNIT
VIPS_META_BITS_PER_SAMPLE
VIPS_META_PALETTE
VIPS_META_LOADER
VIPS_META_SEQUENTIAL
VIPS_META_ORIENTATION
VIPS_META_PAGE_HEIGHT
VIPS_META_N_PAGES
VIPS_META_N_SUBIFDS
VIPS_META_CONCURRENCY