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
- public void clear ()
Removes all tags for all domains (EXIF, IPTC, and XMP).
- public void clear_comment ()
This is a composite clear method that will clear a number of fields.
- public void clear_exif ()
Clears all EXIF metadata from the loaded image.
- public void clear_iptc ()
Clears all IPTC metadata from the loaded image.
- public bool clear_tag (string tag)
Removes the Exiv2 tag from the metadata object.
- public void clear_xmp ()
Clears all XMP metadata from the loaded image.
- public void delete_gps_info ()
Removes all GPS metadata from the loaded image
- public void erase_exif_thumbnail ()
Removes the EXIF thumbnail from the loaded image.
- public void free ()
Destroys the Metadata object and frees all
associated memory.
- public bool from_app1_segment (uint8[] data) throws Error
Load only an EXIF buffer, typically stored in a JPEG's APP1 segment.
- public bool from_stream (InputStream stream) throws Error
Read metadata from a [class@Gio.
- public string? generate_xmp_packet (XmpFormatFlags xmp_format_flags, uint32 padding)
Encode the XMP packet as a null
-terminated string.
- public string? 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).
- public Bytes? get_exif_data (ByteOrder byte_order) throws Error
Returns a binary blob of the contained EXIF data, if the image
contains any.
- public bool get_exif_tag_rational (string tag, out int nom, out int den)
Fetch EXIF tag represented by a fraction.
- public string[] get_exif_tags ()
Query this for a list of available
EXIF tags
- public bool get_exif_thumbnail (out uint8[] buffer)
Get the thumbnail stored in the EXIF data of
this
- public bool get_exposure_time (out int nom, out int den)
Returns the exposure time in seconds (shutter speed, *not* date-time
of exposure) as a rational.
- public double get_fnumber ()
- public double get_focal_length ()
- public bool get_gps_altitude (out double altitude)
Convenience function to query the altitude stored in the GPS tags of
the image
- public bool get_gps_info (out double longitude, out double latitude, out double altitude)
Convenience function to query all available GPS information at once.
- public bool get_gps_latitude (out double latitude)
Query the latitude stored in the GPS tags of
this
- public bool get_gps_longitude (out double longitude)
Query the longitude stored in the GPS tags of
this
- public string[] get_iptc_tags ()
Query this for a list of available
IPTC tags
- public int get_iso_speed ()
- public int get_metadata_pixel_height ()
Composite accessor to query the pixel with stored in the metadata.
- public int get_metadata_pixel_width ()
Composite accessor to query the pixel with stored in the metadata.
- public unowned string get_mime_type ()
Query mime type of currently loaded image.
- public Orientation get_orientation ()
The EXIF Orientation field
- public int get_pixel_height ()
Get the *actual* unoriented display height in pixels of the loaded
image.
- public int get_pixel_width ()
Get the *actual* unoriented display width in pixels of the loaded
image.
- public PreviewImage get_preview_image (PreviewProperties props)
Get a preview image from the metadata.
- public unowned PreviewProperties[]? 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.
- public bool get_supports_exif ()
Query whether the currently loaded image supports writing of EXIF
metadata.
- public bool get_supports_iptc ()
Query whether the currently loaded image supports writing of IPTC
metadata.
- public bool get_supports_xmp ()
Query whether the currently loaded image supports writing of XMP
metadata.
- public string? get_tag_interpreted_string (string tag)
An interpreted string is one fit for user display.
- public long get_tag_long (string tag)
- public string[]? get_tag_multiple (string tag)
- public Bytes? get_tag_raw (string tag)
- public string? get_tag_string (string tag)
- public string? get_xmp_packet ()
Get the currently encoded XMP packet (after having called [
method@GExiv2.
- public string[] get_xmp_tags ()
Get the XMP data from the image.
- public bool has_exif ()
Whether the metadata contains EXIF data.
- public bool has_iptc ()
Whether the image has IPTC metadata
- public bool has_tag (string tag)
Check for presence of a tag.
- public bool has_xmp ()
Whether the metadata contains XMP data.
- public bool open_buf (uint8[] data) throws Error
Populate metadata from a memory buffer.
- public bool open_path (string path) throws Error
Populate metadata from path.
- public bool save_external (string path) throws Error
Saves the metadata to the specified using an XMP sidecar file.
- public bool save_file (string path) throws Error
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.
- public void set_comment (string comment)
This is a composite setter that will set a number of fields to the
supplied value.
- public bool set_exif_tag_rational (string tag, int nom, int den)
Set EXIF tag represented by a fraction, with nom
being the numerator, den the denominator of the fraction.
- public void set_exif_thumbnail_from_buffer (uint8[] buffer)
Sets or replaces the EXIF thumbnail with the data in buffer
.
- public bool set_exif_thumbnail_from_file (string path) throws Error
Sets or replaces the EXIF thumbnail with the image in the file
- public bool set_gps_info (double longitude, double latitude, double altitude)
Convenience function to create a new set of simple GPS data.
- public void set_metadata_pixel_height (int height)
Update the image's metadata with height
- public void set_metadata_pixel_width (int width)
Composite setter to update the image's metadata with width
- public void set_orientation (Orientation orientation)
The orientation must be valid and cannot be [enum@GExiv2.
- public bool set_tag_long (string tag, long value)
- public bool set_tag_multiple (string tag, string[] values)
- public bool set_tag_string (string tag, string value)
- public bool set_xmp_tag_struct (string tag, StructureType type)
- public bool try_clear_tag (string tag) throws Error
Removes the Exiv2 tag from the metadata object.
- public void try_delete_gps_info () throws Error
Removes all GPS metadata from the loaded image
- public void try_erase_exif_thumbnail () throws Error
Removes the EXIF thumbnail from the loaded image.
- public string? try_generate_xmp_packet (XmpFormatFlags xmp_format_flags, uint32 padding) throws Error
Encode the XMP packet as a null
-terminated string.
- public string? try_get_comment () throws Error
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).
- public bool try_get_exif_tag_rational (string tag, out int nom, out int den) throws Error
Fetch EXIF tag represented by a fraction.
- public bool try_get_exposure_time (out int nom, out int den) throws Error
Returns the exposure time in seconds (shutter speed, *not* date-time
of exposure) as a rational.
- public double try_get_fnumber () throws Error
- public double try_get_focal_length () throws Error
- public bool try_get_gps_altitude (out double altitude) throws Error
Convenience function to query the altitude stored in the GPS tags of
the image
- public bool try_get_gps_info (out double longitude, out double latitude, out double altitude) throws Error
Convenience function to query all available GPS information at once.
- public bool try_get_gps_latitude (out double latitude) throws Error
Query the latitude stored in the GPS tags of
this
- public bool try_get_gps_longitude (out double longitude) throws Error
Query the longitude stored in the GPS tags of
this
- public int try_get_iso_speed () throws Error
- public int try_get_metadata_pixel_height () throws Error
Composite accessor to query the pixel with stored in the metadata.
- public int try_get_metadata_pixel_width () throws Error
Composite accessor to query the pixel with stored in the metadata.
- public Orientation try_get_orientation () throws Error
The EXIF Orientation field
- public PreviewImage try_get_preview_image (PreviewProperties props) throws Error
Get a preview image from the metadata.
- public string? try_get_tag_interpreted_string (string tag) throws Error
An interpreted string is one fit for user display.
- public long try_get_tag_long (string tag) throws Error
- public string[]? try_get_tag_multiple (string tag) throws Error
- public Bytes? try_get_tag_raw (string tag) throws Error
- public string? try_get_tag_string (string tag) throws Error
Get a string representationf a tag.
- public string? try_get_xmp_packet () throws Error
Get the currently encoded XMP packet (after having called [
method@GExiv2.
- public bool try_has_tag (string tag) throws Error
- public void try_set_comment (string comment) throws Error
This is a composite setter that will set a number of fields to the
supplied value.
- public bool try_set_exif_tag_rational (string tag, int nom, int den) throws Error
Set EXIF tag represented by a fraction, with nom
being the numerator, den the denominator of the fraction.
- public void try_set_exif_thumbnail_from_buffer (uint8[] buffer) throws Error
Sets or replaces the EXIF thumbnail with the data in buffer
.
- public bool try_set_gps_info (double longitude, double latitude, double altitude) throws Error
Convenience function to create a new set of simple GPS data.
- public void try_set_metadata_pixel_height (int height) throws Error
Update the image's metadata with height
- public void try_set_metadata_pixel_width (int width) throws Error
Composite setter to update the image's metadata with width
- public void try_set_orientation (Orientation orientation) throws Error
The orientation must be valid and cannot be [enum@GExiv2.
- public bool try_set_tag_long (string tag, long value) throws Error
- public bool try_set_tag_multiple (string tag, string[] values) throws Error
- public bool try_set_tag_string (string tag, string value) throws Error
Set the value of a tag using a string.
- public bool try_set_xmp_tag_struct (string tag, StructureType type) throws Error
- public bool try_tag_supports_multiple_values (string tag) throws Error
Check whether a tag supports multiple values.
- public bool try_update_gps_info (double longitude, double latitude, double altitude) throws Error
Convenience function to update longitude, latitude and altitude at
once.
- public bool update_gps_info (double longitude, double latitude, double altitude)
Convenience function to update longitude, latitude and altitude at
once.