### Class

# GExiv2 Metadata

#### Description [src]

    class GExiv2.Metadata : GObject.Object
    {
      /* No available fields */
    }

An object holding all the Exiv2 metadata. Previews, if present, are also available.

It is a generic object that provides everything from simple aggregated accessors to common data such as image comments up to fine-grained access to specific tags of a specfic format, be it EXIF, IPTC or XMP.

As gexiv2 is only a wrapper around Exiv2, it’s better to read its documentation to understand the full scope of what it offers: http://www.exiv2.org/

In particular, rather than providing a getter/setter method pair for every metadata value available for images (of which there are thousands), Exiv2 uses a dotted addressing scheme. For example, to access a photo’s EXIF Orientation field, the caller passes to Exiv2 “Exif.Photo.Orientation”. These tags (in Exiv2 parlance) are key to using Exiv2 (and therefore gexiv2) to its fullest.

A full reference for all supported Exiv2 tags can be found at http://www.exiv2.org/metadata.html.

#### Ancestors

- GObject

#### Constructors

###### gexiv2_metadata_new

Create an empty Metadata object.

#### Functions

###### gexiv2_metadata_get_tag_description

Get Exiv2’s description for a tag.

since: 0.16.0

###### gexiv2_metadata_get_tag_label

Get Exiv2’s label for this tag.

###### gexiv2_metadata_get_tag_type

Get Exiv2’s type name of a tag.

since: 0.16.0

###### gexiv2_metadata_get_xmp_namespace_for_tag

Look up the URI for the namespace for `tag`.

since: 0.16.0

###### gexiv2_metadata_is_exif_tag

Check whether `tag` is from the EXIF domain of tags.

###### gexiv2_metadata_is_iptc_tag

Check whether `tag` is from the IPTC domain of tags.

###### gexiv2_metadata_is_xmp_tag

Check whether `tag` is from the XMP domain of tags.

###### gexiv2_metadata_register_xmp_namespace

Register an additional XMP namespace.

since: 0.16.0

###### gexiv2_metadata_try_get_tag_description

Get Exiv2’s description for a tag.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_tag_label

Get Exiv2’s label for this tag.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_tag_type

Get Exiv2’s type name of a tag.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_xmp_namespace_for_tag

Look up the URI for the namespace for `tag`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_register_xmp_namespace

Register an additional XMP namespace.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_unregister_all_xmp_namespaces

Unregister all XMP namespaces that have been previously registered with `gexiv2_metadata_try_register_xmp_namespace()`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_unregister_xmp_namespace

Unregister a namespace previously registered with `gexiv2_metadata_try_register_xmp_namespace()`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_unregister_all_xmp_namespaces

Unregister all XMP namespaces that have been previously registered with `gexiv2_metadata_try_register_xmp_namespace()`.

since: 0.16.0

###### gexiv2_metadata_unregister_xmp_namespace

Unregister a namespace previously registered with `gexiv2_metadata_try_register_xmp_namespace()`.

since: 0.16.0

#### Instance methods

###### gexiv2_metadata_as_bytes

Saves the metadata to the stream by reading the stream into memory, copying this object’s metadata into the image, then writing the image as a stream back out.

since: 0.16.0

###### gexiv2_metadata_clear

Removes all tags for all domains (EXIF, IPTC, and XMP).

###### gexiv2_metadata_clear_comment

This is a composite clear method that will clear a number of fields. See `gexiv2_metadata_get_comment()` for more information.

###### gexiv2_metadata_clear_exif

Clears all EXIF metadata from the loaded image.

###### gexiv2_metadata_clear_iptc

Clears all IPTC metadata from the loaded image.

###### gexiv2_metadata_clear_tag

Removes the Exiv2 tag from the metadata object.

since: 0.16.0

###### gexiv2_metadata_clear_xmp

Clears all XMP metadata from the loaded image.

###### gexiv2_metadata_delete_gps_info

Removes all GPS metadata from the loaded image.

since: 0.16.0

###### gexiv2_metadata_erase_exif_thumbnail

Removes the EXIF thumbnail from the loaded image.

###### gexiv2_metadata_from_app1_segment

Load only an EXIF buffer, typically stored in a JPEG’s APP1 segment.

###### gexiv2_metadata_from_stream

Read metadata from a `GInputStream`. This function is not very efficient in places since it needs to copy memory to fullfil underlying requirements by exiv2, which expects everything to be memory-mappable.

###### gexiv2_metadata_generate_xmp_packet

Encode the XMP packet as a `NULL`-terminated string.

since: 0.16.0

###### gexiv2_metadata_get_comment

A composite accessor that uses the first available metadata field from a list of well-known locations to find the photo’s comment (or description).

since: 0.16.0

###### gexiv2_metadata_get_exif_data

Returns a binary blob of the contained EXIF data, if the image contains any.

since: 0.12.2

###### gexiv2_metadata_get_exif_tag_rational

Fetch EXIF `tag` represented by a fraction. `nom` will contain the numerator, `den` the denominator of the fraction on successful return.

since: 0.16.0

###### gexiv2_metadata_get_exif_tags

Query `self` for a list of available EXIF tags.

###### gexiv2_metadata_get_exif_thumbnail

Get the thumbnail stored in the EXIF data of `self`.

###### gexiv2_metadata_get_exposure_time

Returns the exposure time in seconds (shutter speed, not date-time of exposure) as a rational. See https://en.wikipedia.org/wiki/Shutter_speed for more information.

since: 0.16.0

###### gexiv2_metadata_get_fnumber

See https://en.wikipedia.org/wiki/F-number for more information. If Exif.Photo.FNumber does not exist, it will fall back to calculating the FNumber from Exif.Photo.ApertureValue (if available).

since: 0.16.0

###### gexiv2_metadata_get_focal_length

See https://en.wikipedia.org/wiki/Flange_focal_distance for more information.

since: 0.16.0

###### gexiv2_metadata_get_gps_altitude

Convenience function to query the altitude stored in the GPS tags of the image.

since: 0.16.0

###### gexiv2_metadata_get_gps_info

Convenience function to query all available GPS information at once. See the `gexiv2_metadata_get_gps_longitude()`, `gexiv2_metadata_get_gps_latitude()` and `gexiv2_metadata_get_gps_altitude()` for possible values of the out parameters.

since: 0.16.0

###### gexiv2_metadata_get_gps_latitude

Query the latitude stored in the GPS tags of `self`.

since: 0.16.0

###### gexiv2_metadata_get_gps_longitude

Query the longitude stored in the GPS tags of `self`.

since: 0.16.0

###### gexiv2_metadata_get_iptc_tags

Query `self` for a list of available IPTC tags.

###### gexiv2_metadata_get_iso_speed

See https://en.wikipedia.org/wiki/Iso_speed for more information.

since: 0.16.0

###### gexiv2_metadata_get_metadata_pixel_height

Composite accessor to query the pixel with stored in the metadata. This might differ from the height of image that is available through `gexiv2_metadata_get_pixel_height()`.

since: 0.16.0

###### gexiv2_metadata_get_metadata_pixel_width

Composite accessor to query the pixel with stored in the metadata. This might differ from the width of image that is available through `gexiv2_metadata_get_pixel_width()`.

since: 0.16.0

###### gexiv2_metadata_get_mime_type

Query mime type of currently loaded image.

###### gexiv2_metadata_get_orientation

The EXIF Orientation field.

since: 0.16.0

###### gexiv2_metadata_get_pixel_height

Get the actual unoriented display height in pixels of the loaded image. This may be different than the height reported by various metadata tags, i.e. `Exif.Photo.PixelYDimension`.

###### gexiv2_metadata_get_pixel_width

Get the actual unoriented display width in pixels of the loaded image. May be different than the width reported by various metadata tags, i.e. `Exif.Photo.PixelXDimension`.

###### gexiv2_metadata_get_preview_image

Get a preview image from the metadata.

since: 0.16.0

###### gexiv2_metadata_get_preview_properties

An image may have stored one or more previews, often of different qualities, sometimes of different image formats than the containing image. This call returns the properties of all previews Exiv2 finds within the loaded image. Use `gexiv2_metadata_get_preview_image()` to load a particular preview into memory.

###### gexiv2_metadata_get_supports_exif

Query whether the currently loaded image supports writing of EXIF metadata.

###### gexiv2_metadata_get_supports_iptc

Query whether the currently loaded image supports writing of IPTC metadata.

###### gexiv2_metadata_get_supports_xmp

Query whether the currently loaded image supports writing of XMP metadata.

###### gexiv2_metadata_get_tag_interpreted_string

An interpreted string is one fit for user display. It may display units or use formatting appropriate to the type of data the tag holds.

since: 0.16.0

###### gexiv2_metadata_get_tag_long

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

since: 0.16.0

###### gexiv2_metadata_get_tag_multiple

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

since: 0.16.0

###### gexiv2_metadata_get_tag_raw

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

since: 0.16.0

###### gexiv2_metadata_get_tag_string

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

since: 0.16.0

###### gexiv2_metadata_get_xmp_packet

Get the currently encoded XMP packet (after having called `gexiv2_metadata_try_get_xmp_packet()`).

since: 0.16.0

###### gexiv2_metadata_get_xmp_tags

Get the XMP data from the image.

###### gexiv2_metadata_has_exif

Whether the metadata contains EXIF data.

###### gexiv2_metadata_has_iptc

Whether the image has IPTC metadata.

###### gexiv2_metadata_has_tag

Check for presence of a tag.

since: 0.16.0

###### gexiv2_metadata_has_xmp

Whether the metadata contains XMP data.

###### gexiv2_metadata_open_buf

Populate metadata from a memory buffer.

###### gexiv2_metadata_open_path

Populate metadata from `path`.

###### gexiv2_metadata_save_external

Saves the metadata to the specified using an XMP sidecar file.

since: 0.10.6

###### gexiv2_metadata_save_file

Saves the metadata to the specified file by reading the file into memory, copying this object’s metadata into the image, then writing the image back out.

###### gexiv2_metadata_set_comment

This is a composite setter that will set a number of fields to the supplied value. See `gexiv2_metadata_get_comment()` for more information.

since: 0.16.0

###### gexiv2_metadata_set_exif_tag_rational

Set EXIF `tag` represented by a fraction, with `nom` being the numerator, `den` the denominator of the fraction.

since: 0.16.0

###### gexiv2_metadata_set_exif_thumbnail_from_buffer

Sets or replaces the EXIF thumbnail with the data in `buffer`.

since: 0.16.0

###### gexiv2_metadata_set_exif_thumbnail_from_file

Sets or replaces the EXIF thumbnail with the image in the file.

###### gexiv2_metadata_set_gps_info

Convenience function to create a new set of simple GPS data. Warning: Will remove any other GPS information that is currently set. See `gexiv2_metadata_update_gps_info()` for just modifying the GPS data.

since: 0.16.0

###### gexiv2_metadata_set_metadata_pixel_height

Update the image’s metadata with `height`.

since: 0.16.0

###### gexiv2_metadata_set_metadata_pixel_width

Composite setter to update the image’s metadata with `width`.

since: 0.16.0

###### gexiv2_metadata_set_orientation

The orientation must be valid and cannot be `GEXIV2_ORIENTATION_UNSPECIFIED`.

since: 0.16.0

###### gexiv2_metadata_set_tag_long

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

since: 0.16.0

###### gexiv2_metadata_set_tag_multiple

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

###### gexiv2_metadata_set_tag_string

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

since: 0.16.0

###### gexiv2_metadata_set_xmp_tag_struct

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

since: 0.16.0

###### gexiv2_metadata_tag_supports_multiple_values

Check whether a tag supports multiple values.

since: 0.16.0

###### gexiv2_metadata_try_clear_tag

Removes the Exiv2 tag from the metadata object.

deprecated: 0.14.0 since: 0.14.0

###### gexiv2_metadata_try_delete_gps_info

Removes all GPS metadata from the loaded image.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_erase_exif_thumbnail

Removes the EXIF thumbnail from the loaded image.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_generate_xmp_packet

Encode the XMP packet as a `NULL`-terminated string.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_comment

A composite accessor that uses the first available metadata field from a list of well-known locations to find the photo’s comment (or description).

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_exif_tag_rational

Fetch EXIF `tag` represented by a fraction. `nom` will contain the numerator, `den` the denominator of the fraction on successful return.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_exposure_time

Returns the exposure time in seconds (shutter speed, not date-time of exposure) as a rational. See https://en.wikipedia.org/wiki/Shutter_speed for more information.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_fnumber

See https://en.wikipedia.org/wiki/F-number for more information. If Exif.Photo.FNumber does not exist, it will fall back to calculating the FNumber from Exif.Photo.ApertureValue (if available);.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_focal_length

See https://en.wikipedia.org/wiki/Flange_focal_distance for more information.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_gps_altitude

Convenience function to query the altitude stored in the GPS tags of the image.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_gps_info

Convenience function to query all available GPS information at once.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_gps_latitude

Query the latitude stored in the GPS tags of `self`.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_gps_longitude

Query the longitude stored in the GPS tags of `self`.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_iso_speed

See https://en.wikipedia.org/wiki/Iso_speed for more information.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_metadata_pixel_height

Composite accessor to query the pixel with stored in the metadata. This might differ from the height of image that is available through `gexiv2_metadata_get_pixel_height()`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_metadata_pixel_width

Composite accessor to query the pixel with stored in the metadata. This might differ from the width of image that is available through `gexiv2_metadata_get_pixel_width()`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_orientation

The EXIF Orientation field.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_preview_image

Get a preview image from the metadata.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_get_tag_interpreted_string

An interpreted string is one fit for user display. It may display units or use formatting appropriate to the type of data the tag holds.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_tag_long

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

deprecated: 0.12.2 since: 0.12.2

###### gexiv2_metadata_try_get_tag_multiple

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_tag_raw

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_tag_string

Get a string representationf a tag.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_get_xmp_packet

Get the currently encoded XMP packet (after having called `gexiv2_metadata_try_generate_xmp_packet()`).

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_has_tag

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_set_comment

This is a composite setter that will set a number of fields to the supplied value. See `gexiv2_metadata_get_comment()` for more information.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_set_exif_tag_rational

Set EXIF `tag` represented by a fraction, with `nom` being the numerator, `den` the denominator of the fraction.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_set_exif_thumbnail_from_buffer

Sets or replaces the EXIF thumbnail with the data in `buffer`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_set_gps_info

Convenience function to create a new set of simple GPS data. Warning: Will remove any other GPS information that is currently set. See `gexiv2_metadata_update_gps_info()` for just modifying the GPS data.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_set_metadata_pixel_height

Update the image’s metadata with `height`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_set_metadata_pixel_width

Composite setter to update the image’s metadata with `width`.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_set_orientation

The orientation must be valid and cannot be [enum@GExiv2.Orientation.UNSPECIFIED.

deprecated: 0.16.0 since: 0.14.0

###### gexiv2_metadata_try_set_tag_long

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_set_tag_multiple

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_set_tag_string

Set the value of a tag using a string.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_set_xmp_tag_struct

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_try_tag_supports_multiple_values

Check whether a tag supports multiple values.

deprecated: 0.16.0. since: 0.14.0

###### gexiv2_metadata_try_update_gps_info

Convenience function to update longitude, latitude and altitude at once.

deprecated: 0.16.0 since: 0.12.2

###### gexiv2_metadata_update_gps_info

Convenience function to update longitude, latitude and altitude at once.

since: 0.16.0

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GExiv2MetadataClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.