GExiv2.Metadata¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent_instance |
r |
Class Details¶
- class GExiv2.Metadata(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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>
- classmethod get_tag_description(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
The tag’s description
- Return type:
Get Exiv2’s description for a tag.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- classmethod get_tag_label(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
The tag’s label
- Return type:
Get Exiv2’s label for this tag.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
- classmethod get_tag_type(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
The tag’s type name.
- Return type:
Get Exiv2’s type name of a tag.
The names of the various Exiv2 tag types can be found at Exiv2::TypeId, <http://exiv2.org/doc/namespaceExiv2.html#a5153319711f35fe81cbc13f4b852450c>
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- classmethod get_xmp_namespace_for_tag(tag)[source]¶
- Parameters:
tag (
str) – Full tag name (e.g. “Xmp.dc.subject”) or XMP namespace identifier (e.g. “dc”)- Raises:
- Returns:
Noneif there was no namespace registered for the tag, the URI of the namespace otherwise.- Return type:
Look up the URI for the namespace for tag
New in version 0.16.0.
- classmethod is_exif_tag(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Returns:
Trueif the Exiv2 tag is for the EXIF domain.- Return type:
Check whether tag is from the EXIF domain of tags.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
- classmethod is_iptc_tag(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Returns:
Trueif the Exiv2 tag is for the IPTC domain.- Return type:
Check whether tag is from the IPTC domain of tags.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
- classmethod is_xmp_tag(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Returns:
Trueif the Exiv2 tag is for the XMP domain.- Return type:
Check whether tag is from the XMP domain of tags.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
- classmethod new()[source]¶
- Returns:
A fully constructed [class`GExiv2`.Metadata] ready to be used
- Return type:
Create an empty Metadata object.
To use it, either use the many setter functions to popuplate the data from scratch or use [method`GExiv2`.Metadata.open_path] or [method`GExiv2`.Metadata.open_buf] to populate it from an existing file.
- classmethod register_xmp_namespace(name, prefix)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value
- Return type:
Register an additional XMP namespace.
New in version 0.16.0.
- classmethod try_get_tag_description(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
The tag’s description
- Return type:
Get Exiv2’s description for a tag.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [func`Metadata`.get_tag_description] instead.
- classmethod try_get_tag_label(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
The tag’s label
- Return type:
Get Exiv2’s label for this tag.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [func`Metadata`.get_tag_label] instead.
- classmethod try_get_tag_type(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
The tag’s type name.
- Return type:
Get Exiv2’s type name of a tag.
The names of the various Exiv2 tag types can be found at Exiv2::TypeId, <http://exiv2.org/doc/namespaceExiv2.html#a5153319711f35fe81cbc13f4b852450c>
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [func`Metadata`.get_tag_type] instead.
- classmethod try_get_xmp_namespace_for_tag(tag)[source]¶
- Parameters:
tag (
str) – Full tag name (e.g. “Xmp.dc.subject”) or XMP namespace identifier (e.g. “dc”)- Raises:
- Returns:
Noneif there was no namespace registered for the tag, the URI of the namespace otherwise.- Return type:
Look up the URI for the namespace for tag
New in version 0.14.0.
Deprecated since version 0.16.0: Use [func`Metadata`.try_get_xmp_namespace_for_tag] instead.
- classmethod try_register_xmp_namespace(name, prefix)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value
- Return type:
Register an additional XMP namespace.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [func`Metadata`.register_xmp_namespace] instead.
- classmethod try_unregister_all_xmp_namespaces()[source]¶
- Raises:
Unregister all XMP namespaces that have been previously registered with [func`Metadata`.try_register_xmp_namespace].
New in version 0.14.0.
Deprecated since version 0.16.0: Use [func`Metadata`.register_xmp_namespace] instead
- classmethod try_unregister_xmp_namespace(name)[source]¶
- Parameters:
name (
str) – XMP URI name (should end in /)- Raises:
- Returns:
Boolean success value
- Return type:
Unregister a namespace previously registered with [func`Metadata`.try_register_xmp_namespace].
New in version 0.14.0.
Deprecated since version 0.16.0: Use [func`Metadata`.try_unregister_xmp_namespace] instead.
- classmethod unregister_all_xmp_namespaces()[source]¶
- Raises:
Unregister all XMP namespaces that have been previously registered with [func`Metadata`.try_register_xmp_namespace].
New in version 0.16.0.
- classmethod unregister_xmp_namespace(name)[source]¶
- Parameters:
name (
str) – XMP URI name (should end in /)- Raises:
- Returns:
Boolean success value
- Return type:
Unregister a namespace previously registered with [func`Metadata`.try_register_xmp_namespace].
New in version 0.16.0.
- as_bytes(bytes)[source]¶
- Parameters:
bytes (
GLib.BytesorNone) – An image buffer to update the metadata on, norNone- Raises:
- Returns:
A newly allocated
GLib.Bytesobject containing the image with new metadata- Return type:
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.
if bytes is
None, a copy of the internal image with updated metadata will be returned.New in version 0.16.0.
- clear_comment()[source]¶
This is a composite clear method that will clear a number of fields. See [method`Metadata`.get_comment] for more information.
- clear_tag(tag)[source]¶
-
Removes the Exiv2 tag from the metadata object.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- delete_gps_info()[source]¶
- Raises:
Removes all GPS metadata from the loaded image
New in version 0.16.0.
- from_app1_segment(data)[source]¶
- Parameters:
data (
bytes) – A buffer containing the data to be read- Raises:
- Returns:
Boolean success indicator.
- Return type:
Load only an EXIF buffer, typically stored in a JPEG’s APP1 segment.
- from_stream(stream)[source]¶
- Parameters:
stream (
Gio.InputStream) –- Raises:
- Return type:
Read metadata from a [class`Gio`.InputStream]. 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.
- generate_xmp_packet(xmp_format_flags, padding)[source]¶
- Parameters:
xmp_format_flags (
GExiv2.XmpFormatFlags) – One ofGExiv2.XmpFormatFlagspadding (
int) – The padding before the closing<?xpacket>tag
- Raises:
- Returns:
Encode the XMP packet and return as a
None-terminated string.- Return type:
Encode the XMP packet as a
None-terminated string.New in version 0.16.0.
- get_comment()[source]¶
- Raises:
- Returns:
The photo’s comment field.
- Return type:
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).
MWG guidelines refer to these as *Description*: a textual description of a resource’s content.
These fields are:
Exif.Image.ImageDescription (MWG Guidelines)
Exif.Photo.UserComment
Exif.Image.XPComment
Iptc.Application2.Caption (MWG Guidelines)
Xmp.dc.description (MWG Guidelines)
Xmp.acdsee.notes (Commonly requested, read only)
Note that in the EXIF specification Exif.Image.ImageDescription is described as “the title of the image”. Also, it does not support two-byte character codes for encoding. However, it’s still used here for legacy reasons.
For fine-grained control, it’s recommended to use Exiv2 tags directly rather than this method, which is more useful for quick or casual use.
New in version 0.16.0.
- get_exif_data(byte_order)[source]¶
- Parameters:
byte_order (
GExiv2.ByteOrder) – Whether to export the data in little or big endian format- Raises:
- Returns:
The content of the EXIF data or
Noneon error- Return type:
GLib.BytesorNone
Returns a binary blob of the contained EXIF data, if the image contains any.
New in version 0.12.2.
- get_exif_tag_rational(tag)[source]¶
- Parameters:
tag (
str) – The tag you want the rational value for- Raises:
- Returns:
Boolean success value
- nom:
The numerator
- den:
The denominator
- Return type:
Fetch EXIF tag represented by a fraction. nom will contain the numerator, den the denominator of the fraction on successful return.
New in version 0.16.0.
- get_exif_tags()[source]¶
- Returns:
A unique list of the available EXIF tags in the loaded image
- Return type:
[
str]
Query self for a list of available EXIF tags
- get_exif_thumbnail()[source]¶
- Returns:
Boolean success value
- buffer:
Where to store the thumbnail data
- Return type:
Get the thumbnail stored in the EXIF data of self
- get_exposure_time()[source]¶
- Raises:
- Returns:
Boolean success value
- nom:
The numerator
- den:
The denominator
- Return type:
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.
New in version 0.16.0.
- get_fnumber()[source]¶
- Raises:
- Returns:
The exposure Fnumber as a
float, or -1.0 if tag is not present or invalid.- Return type:
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)
New in version 0.16.0.
- get_focal_length()[source]¶
- Raises:
- Returns:
The focal length as a
float, or -1.0 if tag is not present or invalid.- Return type:
See <https://en.wikipedia.org/wiki/Flange_focal_distance> for more information.
New in version 0.16.0.
- get_gps_altitude()[source]¶
- Raises:
- Returns:
The altitude value, or -inf on error, or nan if no altitude value.
- Return type:
Convenience function to query the altitude stored in the GPS tags of the image
New in version 0.16.0.
- get_gps_info()[source]¶
- Raises:
- Returns:
Boolean success value. Indicates if any of the queries failed.
- longitude:
Storage for longitude value
- latitude:
Storage for latitude value
- altitude:
Storage for altitude value
- Return type:
Convenience function to query all available GPS information at once. See the [method`GExiv2`.Metadata.get_gps_longitude], [method`GExiv2`.Metadata.get_gps_latitude] and [method`GExiv2`.Metadata.get_gps_altitude] for possible values of the out parameters.
New in version 0.16.0.
- get_gps_latitude()[source]¶
- Raises:
- Returns:
The latitude or -inf on error, nan if no altitude value is found.
- Return type:
Query the latitude stored in the GPS tags of self
New in version 0.16.0.
- get_gps_longitude()[source]¶
- Raises:
- Returns:
The longitude value, or -inf on error, or nan if no altitude value.
- Return type:
Query the longitude stored in the GPS tags of self
New in version 0.16.0.
- get_iptc_tags()[source]¶
- Returns:
A unique list of the available IPTC tags
- Return type:
[
str]
Query self for a list of available IPTC tags
- get_iso_speed()[source]¶
- Raises:
- Returns:
The ISO speed rating as a
int, or 0 if tag is not present or invalid.- Return type:
See <https://en.wikipedia.org/wiki/Iso_speed> for more information.
New in version 0.16.0.
- get_metadata_pixel_height()[source]¶
- Raises:
- Returns:
Height of images in pixels as stored in the metadata
- Return type:
Composite accessor to query the pixel with stored in the metadata. This might differ from the height of image that is available through [method`Metadata`.get_pixel_height]
New in version 0.16.0.
- get_metadata_pixel_width()[source]¶
- Raises:
- Returns:
Width of images in pixels as stored in the metadata
- Return type:
Composite accessor to query the pixel with stored in the metadata. This might differ from the width of image that is available through [method`Metadata`.get_pixel_width]
New in version 0.16.0.
- get_orientation()[source]¶
- Raises:
- Returns:
A [enum`GExiv2`.Orientation] value representing the EXIF orientation value.
- Return type:
The EXIF Orientation field
New in version 0.16.0.
- get_pixel_height()[source]¶
- Returns:
Pixel height of current image
- Return type:
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.
- get_pixel_width()[source]¶
- Returns:
Pixel width of current image
- Return type:
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.
- get_preview_image(props)[source]¶
- Parameters:
props (
GExiv2.PreviewProperties) – AGExiv2.PreviewPropertiesinstance- Raises:
- Returns:
A
GExiv2.PreviewImageinstance for the particularGExiv2.PreviewProperties.- Return type:
Get a preview image from the metadata.
New in version 0.16.0.
- get_preview_properties()[source]¶
- Returns:
An array of
GExiv2.PreviewPropertiesinstances, one for each preview present in the loaded image.- Return type:
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 [method`Metadata`.get_preview_image] to load a particular preview into memory.
- get_supports_exif()[source]¶
-
Query whether the currently loaded image supports writing of EXIF metadata.
- get_supports_iptc()[source]¶
-
Query whether the currently loaded image supports writing of IPTC metadata.
- get_supports_xmp()[source]¶
-
Query whether the currently loaded image supports writing of XMP metadata.
- get_tag_interpreted_string(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The tag’s interpreted value as a string
- Return type:
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.
Tags that support multiple values are returned as a single string, with elements separated by “, “.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- get_tag_long(tag)[source]¶
-
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- get_tag_multiple(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The multiple string values of the tag. Returns
Noneif parameters areNoneor tag does not begin with recognised type of metadata (“Exif.”, “Xmp.” or “Iptc.”). For a well formed tag, returns array[0] =Noneif tag is undefined or is not set in the current metadata.- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
In case of error, a GLib warning will be logged. Use instead [method`Metadata`.try_get_tag_multiple] if you want to avoid this and control if and how the error is outputted.
New in version 0.16.0.
- get_tag_raw(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The tag’s raw value as a byte array
- Return type:
GLib.BytesorNone
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
Tags that support multiple values may bereturned as a single byte array, with records separated by 4x INFORMATION SEPARATOR FOUR (ASCII 0x1c)
New in version 0.16.0.
- get_tag_string(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The tag’s value as a string
- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
Tags that support multiple values are returned as a single string, with elements separated by “, “.
In case of error, a GLib warning will be logged. Use instead [method`Metadata`.try_get_tag_string] if you want to avoid this and control if and how the error is outputted.
New in version 0.16.0.
- get_xmp_packet()[source]¶
- Raises:
- Returns:
The currently-encoded XMP packet (see [method`Metadata`.generate_xmp_packet]).
- Return type:
Get the currently encoded XMP packet (after having called [method`GExiv2`.Metadata.try_get_xmp_packet])
New in version 0.16.0.
- get_xmp_tags()[source]¶
- Returns:
A unique list of the available XMP tags
- Return type:
[
str]
Get the XMP data from the image.
This could contain multiple XML snippets.
- has_tag(tag)[source]¶
-
Check for presence of a tag.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- open_buf(data)[source]¶
- Parameters:
data (
bytes) – A buffer containing the data to be read- Raises:
- Returns:
Boolean success indicator
- Return type:
Populate metadata from a memory buffer.
The buffer must be an image format supported by Exiv2. If called multiple times, current metadata will be replaced by the content of the last file opened.
When called on an already filled meta-data object (i.e. one that has already been filled by a previous call of [method`GExiv2`.Metadata.open_path]) and the opening of the new path fails, the object will not revert to its previous state but be in a similar state after calling [method`GExiv2`.Metadata.new].
- open_path(path)[source]¶
- Parameters:
path (
str) – Path to the file you want to open- Raises:
- Returns:
Boolean success indicator
- Return type:
Populate metadata from path.
The file must be an image format supported by Exiv2. If called multiple times, current metadata will be replaced by the content of the last file opened.
- save_external(path)[source]¶
- Parameters:
path (
str) – Path to the file you want to save to.- Raises:
- Returns:
Boolean success indicator.
- Return type:
Saves the metadata to the specified using an XMP sidecar file.
New in version 0.10.6.
- save_file(path)[source]¶
- Parameters:
path (
str) – Path to the file you want to save to.- Raises:
- Returns:
Boolean success indicator.
- Return type:
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.
- set_comment(comment)[source]¶
- Parameters:
- Raises:
This is a composite setter that will set a number of fields to the supplied value. See [method`Metadata`.get_comment] for more information.
New in version 0.16.0.
- set_exif_tag_rational(tag, nom, den)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value
- Return type:
Set EXIF tag represented by a fraction, with nom being the numerator, den the denominator of the fraction.
New in version 0.16.0.
- set_exif_thumbnail_from_buffer(buffer)[source]¶
- Parameters:
buffer (
bytes) – A buffer containing thumbnail data- Raises:
Sets or replaces the EXIF thumbnail with the data in buffer.
New in version 0.16.0.
- set_exif_thumbnail_from_file(path)[source]¶
- Parameters:
path (
str) – Path of image file- Raises:
- Returns:
Boolean success value
- Return type:
Sets or replaces the EXIF thumbnail with the image in the file
- set_gps_info(longitude, latitude, altitude)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value.
- Return type:
Convenience function to create a new set of simple GPS data. Warning: Will remove any other GPS information that is currently set. See [method`Metadata`.update_gps_info] for just modifying the GPS data.
New in version 0.16.0.
- set_metadata_pixel_height(height)[source]¶
- Parameters:
height (
int) – The width of the image as it should be put into the metadata.- Raises:
Update the image’s metadata with height
New in version 0.16.0.
- set_metadata_pixel_width(width)[source]¶
- Parameters:
width (
int) – The width of the image as it should be put into the metadata- Raises:
Composite setter to update the image’s metadata with width
New in version 0.16.0.
- set_orientation(orientation)[source]¶
- Parameters:
orientation (
GExiv2.Orientation) – The new [enum`GExiv2`.Orientation] for the image.- Raises:
The orientation must be valid and cannot be [enum`GExiv2`.Orientation.UNSPECIFIED].
New in version 0.16.0.
- set_tag_long(tag, value)[source]¶
- Parameters:
- Raises:
- Returns:
Trueon success- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- set_tag_multiple(tag, values)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value
- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
All previous tag values are erased. For multiple value tags, each of the non
Noneentries in values is stored. For single value tags, only the last nonNonevalue is assigned.
- set_tag_string(tag, value)[source]¶
- Parameters:
- Raises:
- Returns:
Trueon success- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
If a tag supports multiple values, then value is added to any existing values. For single value tags, value replaces the value.
In case of error, a GLib warning will be logged. Use instead [method`Metadata`.try_set_tag_string] if you want to avoid this and control if and how the error is outputted.
New in version 0.16.0.
- set_xmp_tag_struct(tag, type)[source]¶
- Parameters:
tag (
str) – Exiv2 tag nametype (
GExiv2.StructureType) – TheGExiv2.StructureTypespecifying the type of structure
- Raises:
- Returns:
Trueon success- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- tag_supports_multiple_values(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
Whether tag is capable of storing multiple values or not. If tag is undefined (i.e. not built-in and not added to self), then error is set and
Falseis returned.- Return type:
Check whether a tag supports multiple values.
Multiple value tags are Xmp tags of type “XmpAlt”, “XmpBag”, “XmpSeq” or “LangAlt”, or Iptc tags marked as Repeatable (which can be of any Iptc type). There are no multiple value Exif tags.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.16.0.
- try_clear_tag(tag)[source]¶
-
Removes the Exiv2 tag from the metadata object.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.14.0.
Deprecated since version 0.14.0: Use [method`Metadata`.clear_tag] instead.
- try_delete_gps_info()[source]¶
- Raises:
Removes all GPS metadata from the loaded image
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.delete_gps_info] instead.
- try_erase_exif_thumbnail()[source]¶
- Raises:
Removes the EXIF thumbnail from the loaded image.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.erase_exif_thumbnail] instead.
- try_generate_xmp_packet(xmp_format_flags, padding)[source]¶
- Parameters:
xmp_format_flags (
GExiv2.XmpFormatFlags) – One ofGExiv2.XmpFormatFlagspadding (
int) – The padding before the closing<?xpacket>tag
- Raises:
- Returns:
Encode the XMP packet and return as a
None-terminated string.- Return type:
Encode the XMP packet as a
None-terminated string.New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.try_generate_xmp_packet] instead.
- try_get_comment()[source]¶
- Raises:
- Returns:
The photo’s comment field.
- Return type:
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).
MWG guidelines refer to these as *Description*: a textual description of a resource’s content.
These fields are:
Exif.Image.ImageDescription (MWG Guidelines)
Exif.Photo.UserComment
Exif.Image.XPComment
Iptc.Application2.Caption (MWG Guidelines)
Xmp.dc.description (MWG Guidelines)
Xmp.acdsee.notes (Commonly requested, read only)
Note that in the EXIF specification Exif.Image.ImageDescription is described as “the title of the image”. Also, it does not support two-byte character codes for encoding. However, it’s still used here for legacy reasons.
For fine-grained control, it’s recommended to use Exiv2 tags directly rather than this method, which is more useful for quick or casual use.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_comment] instead.
- try_get_exif_tag_rational(tag)[source]¶
- Parameters:
tag (
str) – The tag you want the rational value for- Raises:
- Returns:
Boolean success value
- nom:
The numerator
- den:
The denominator
- Return type:
Fetch EXIF tag represented by a fraction. nom will contain the numerator, den the denominator of the fraction on successful return.
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_exif_tag_rational] instead.
- try_get_exposure_time()[source]¶
- Raises:
- Returns:
Boolean success value
- nom:
The numerator
- den:
The denominator
- Return type:
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.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_exposure_time] instead.
- try_get_fnumber()[source]¶
- Raises:
- Returns:
The exposure Fnumber as a
float, or -1.0 if tag is not present or invalid.- Return type:
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);
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_fnumber] instead.
- try_get_focal_length()[source]¶
- Raises:
- Returns:
The focal length as a
float, or -1.0 if tag is not present or invalid.- Return type:
See <https://en.wikipedia.org/wiki/Flange_focal_distance> for more information.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_focal_length] instead.
- try_get_gps_altitude()[source]¶
- Raises:
- Returns:
Boolean success value
- altitude:
Variable to store the altitude value
- Return type:
Convenience function to query the altitude stored in the GPS tags of the image
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_gps_latitude] instead.
- try_get_gps_info()[source]¶
- Raises:
- Returns:
Boolean success value.
- longitude:
Storage for longitude value
- latitude:
Storage for latitude value
- altitude:
Storage for altitude value
- Return type:
Convenience function to query all available GPS information at once.
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_gps_info] instead.
- try_get_gps_latitude()[source]¶
- Raises:
- Returns:
Boolean success value
- latitude:
Variable to store the latitude value
- Return type:
Query the latitude stored in the GPS tags of self
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_gps_altitude] instead.
- try_get_gps_longitude()[source]¶
- Raises:
- Returns:
Boolean success value
- longitude:
Variable to store the longitude value
- Return type:
Query the longitude stored in the GPS tags of self
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_gps_longitude] instead.
- try_get_iso_speed()[source]¶
- Raises:
- Returns:
The ISO speed rating as a
int, or 0 if tag is not present or invalid.- Return type:
See <https://en.wikipedia.org/wiki/Iso_speed> for more information.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_iso_speed] instead.
- try_get_metadata_pixel_height()[source]¶
- Raises:
- Returns:
Height of images in pixels as stored in the metadata
- Return type:
Composite accessor to query the pixel with stored in the metadata. This might differ from the height of image that is available through [method`Metadata`.get_pixel_height]
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_metadata_pixel_height] instead.
- try_get_metadata_pixel_width()[source]¶
- Raises:
- Returns:
Width of images in pixels as stored in the metadata
- Return type:
Composite accessor to query the pixel with stored in the metadata. This might differ from the width of image that is available through [method`Metadata`.get_pixel_width]
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_metadata_pixel_width] instead.
- try_get_orientation()[source]¶
- Raises:
- Returns:
A [enum`GExiv2`.Orientation] value representing the EXIF orientation value.
- Return type:
The EXIF Orientation field
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_orientation] instead.
- try_get_preview_image(props)[source]¶
- Parameters:
props (
GExiv2.PreviewProperties) – AGExiv2.PreviewPropertiesinstance- Raises:
- Returns:
A
GExiv2.PreviewImageinstance for the particularGExiv2.PreviewProperties.- Return type:
Get a preview image from the metadata.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.get_preview_image] instead.
- try_get_tag_interpreted_string(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The tag’s interpreted value as a string
- Return type:
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.
Tags that support multiple values are returned as a single string, with elements separated by “, “.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_tag_interpreted_string] instead.
- try_get_tag_long(tag)[source]¶
-
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.12.2: Use [method`Metadata`.get_tag_long] instead.
- try_get_tag_multiple(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The multiple string values of tag. Returns
Noneif parameters areNoneor tag does not begin with recognised type of metadata (“Exif.”, “Xmp.” or “Iptc.”). For a well formed tag, returns array[0] =Noneif tag is undefined or is not set in the current metadata.- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_tag_multiple] instead.
- try_get_tag_raw(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The tag’s raw value as a byte array
- Return type:
GLib.BytesorNone
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
Tags that support multiple values may be returned as a single byte array, with records separated by 4x INFORMATION SEPARATOR FOUR (ASCII 0x1c)
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_tag_raw] instead.
- try_get_tag_string(tag)[source]¶
- Parameters:
tag (
str) – Exiv2 tag name- Raises:
- Returns:
The tag’s value as a string
- Return type:
Get a string representationf a tag.
Tags that support multiple values are returned as a single string, with elements separated by “, “.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.get_tag_string] instead.
- try_get_xmp_packet()[source]¶
- Raises:
- Returns:
Noneif no packet was generated previously, the XMP packet contents otherwise- Return type:
Get the currently encoded XMP packet (after having called [method`GExiv2`.Metadata.try_generate_xmp_packet])
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.try_get_xmp_packet] instead.
- try_has_tag(tag)[source]¶
-
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.has_tag] instead.
- try_set_comment(comment)[source]¶
- Parameters:
- Raises:
This is a composite setter that will set a number of fields to the supplied value. See [method`Metadata`.get_comment] for more information.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.set_comment] instead.
- try_set_exif_tag_rational(tag, nom, den)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value
- Return type:
Set EXIF tag represented by a fraction, with nom being the numerator, den the denominator of the fraction.
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.set_exif_tag_rational] instead.
- try_set_exif_thumbnail_from_buffer(buffer)[source]¶
- Parameters:
buffer (
bytes) – A buffer containing thumbnail data- Raises:
Sets or replaces the EXIF thumbnail with the data in buffer.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.set_exif_thumbnail_from_buffer] instead.
- try_set_gps_info(longitude, latitude, altitude)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value.
- Return type:
Convenience function to create a new set of simple GPS data. Warning: Will remove any other GPS information that is currently set. See [method`Metadata`.update_gps_info] for just modifying the GPS data.
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.set_gps_info] instead.
- try_set_metadata_pixel_height(height)[source]¶
- Parameters:
height (
int) – The width of the image as it should be put into the metadata.- Raises:
Update the image’s metadata with height
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.set_metadata_pixel_height] instead.
- try_set_metadata_pixel_width(width)[source]¶
- Parameters:
width (
int) – The width of the image as it should be put into the metadata- Raises:
Composite setter to update the image’s metadata with width
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.set_metadata_pixel_width] instead.
- try_set_orientation(orientation)[source]¶
- Parameters:
orientation (
GExiv2.Orientation) – The new [enum`GExiv2`.Orientation] for the image.- Raises:
The orientation must be valid and cannot be [enum`GExiv2`.Orientation.UNSPECIFIED.
New in version 0.14.0.
Deprecated since version 0.16.0: Use [method`Metadata`.set_orientation] instead.
- try_set_tag_long(tag, value)[source]¶
- Parameters:
- Raises:
- Returns:
Trueon success- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.set_tag_long] instead.
- try_set_tag_multiple(tag, values)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value
- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
All previous tag values are erased. For multiple value tags, each of the non
Noneentries in values is stored. For single value tags, only the last nonNonevalue is assigned.New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.set_tag_multiple] instead.
- try_set_tag_string(tag, value)[source]¶
- Parameters:
- Raises:
- Returns:
Trueon success- Return type:
Set the value of a tag using a string.
If a tag supports multiple values, then value is added to any existing values. For single tags, value replaces the value.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.set_tag_string] instead.
- try_set_xmp_tag_struct(tag, type)[source]¶
- Parameters:
tag (
str) – Exiv2 tag nametype (
GExiv2.StructureType) – TheGExiv2.StructureTypespecifying the type of structure
- Raises:
- Returns:
Trueon success- Return type:
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.set_xmp_tag_struct] instead.
- try_tag_supports_multiple_values(tag)[source]¶
- Parameters:
tag (
str) – An Exiv2 tag- Raises:
- Returns:
Whether tag is capable of storing multiple values or not. If tag is undefined (i.e. not built-in and not added to self), then error is set and
Falseis returned.- Return type:
Check whether a tag supports multiple values.
Multiple value tags are Xmp tags of type “XmpAlt”, “XmpBag”, “XmpSeq” or “LangAlt”, or Iptc tags marked as Repeatable (which can be of any Iptc type). There are no multiple value Exif tags.
The Exiv2 Tag Reference can be found at <http://exiv2.org/metadata.html>
New in version 0.14.0.
Deprecated since version 0.16.0.: Use [method`GExiv2`.Metadata.tag_supports_multiple_values] instead.
- try_update_gps_info(longitude, latitude, altitude)[source]¶
- Parameters:
- Raises:
- Returns:
Boolean success value.
- Return type:
Convenience function to update longitude, latitude and altitude at once.
New in version 0.12.2.
Deprecated since version 0.16.0: Use [method`Metadata`.update_gps_info] instead.