Gimp.Metadata

g GObject.Object GObject.Object Gimp.Metadata Gimp.Metadata GObject.Object->Gimp.Metadata

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

deserialize (metadata_xml)

class

get_guid ()

class

is_tag_supported (tag, mime_type)

class

load_from_file (file)

class

new ()

add_xmp_history (state_status)

duplicate ()

get_colorspace ()

get_resolution ()

save_to_file (file)

serialize ()

set_bits_per_sample (bits_per_sample)

set_colorspace (colorspace)

set_creation_date (datetime)

set_from_exif (exif_data)

set_from_iptc (iptc_data)

set_from_xmp (xmp_data)

set_pixel_size (width, height)

set_resolution (xres, yres, unit)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Gimp.Metadata(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gimp.MetadataClass

Basic functions for handling Gimp.Metadata objects.

classmethod deserialize(metadata_xml)
Parameters:

metadata_xml (str) – A string of serialized metadata XML.

Returns:

The new Gimp.Metadata.

Return type:

Gimp.Metadata

Deserializes a string of XML that has been created by Gimp.Metadata.serialize().

New in version 2.10.

classmethod get_guid()
Returns:

The new GUID/UUID string.

Return type:

str

Generate Version 4 UUID/GUID.

New in version 2.10.

classmethod is_tag_supported(tag, mime_type)
Parameters:
  • tag (str) – A metadata tag name

  • mime_type (str) – A mime type

Returns:

True if the tag supported with mime_type, False otherwise.

Return type:

bool

Returns whether tag is supported in a file of type mime_type.

New in version 2.10.

classmethod load_from_file(file)
Parameters:

file (Gio.File) – The Gio.File to load the metadata from

Raises:

GLib.Error

Returns:

The loaded Gimp.Metadata.

Return type:

Gimp.Metadata

Loads Gimp.Metadata from file.

New in version 2.10.

classmethod new()
Returns:

The new Gimp.Metadata.

Return type:

Gimp.Metadata

Creates a new Gimp.Metadata instance.

New in version 2.10.

add_xmp_history(state_status)
Parameters:

state_status (str) –

duplicate()
Returns:

The new Gimp.Metadata, or None if self is None.

Return type:

Gimp.Metadata

Duplicates a Gimp.Metadata instance.

New in version 2.10.

get_colorspace()
Returns:

The colorspace specified by above tags.

Return type:

Gimp.MetadataColorspace

Returns values based on Exif.Photo.ColorSpace, Xmp.exif.ColorSpace, Exif.Iop.InteroperabilityIndex, Exif.Nikon3.ColorSpace, Exif.Canon.ColorSpace of self.

New in version 2.10.

get_resolution()
Returns:

True on success, False otherwise.

xres:

Return location for the X Resolution, in ppi

yres:

Return location for the Y Resolution, in ppi

unit:

Return location for the unit unit

Return type:

(bool, xres: float, yres: float, unit: Gimp.Unit)

Returns values based on Exif.Image.XResolution, Exif.Image.YResolution and Exif.Image.ResolutionUnit of self.

New in version 2.10.

save_to_file(file)
Parameters:

file (Gio.File) – The file to save the metadata to

Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

Saves self to file.

New in version 2.10.

serialize()
Returns:

The serialized XML string.

Return type:

str

Serializes self into an XML string that can later be deserialized using Gimp.Metadata.deserialize().

New in version 2.10.

set_bits_per_sample(bits_per_sample)
Parameters:

bits_per_sample (int) – Bits per pixel, per component

Sets Exif.Image.BitsPerSample on self.

New in version 2.10.

set_colorspace(colorspace)
Parameters:

colorspace (Gimp.MetadataColorspace) – The color space.

Sets Exif.Photo.ColorSpace, Xmp.exif.ColorSpace, Exif.Iop.InteroperabilityIndex, Exif.Nikon3.ColorSpace, Exif.Canon.ColorSpace of self.

New in version 2.10.

set_creation_date(datetime)
Parameters:

datetime (GLib.DateTime) – A GLib.DateTime value

Sets Iptc.Application2.DateCreated, Iptc.Application2.TimeCreated, Exif.Image.DateTime, Exif.Image.DateTimeOriginal, Exif.Photo.DateTimeOriginal, Exif.Photo.DateTimeDigitized, Exif.Photo.OffsetTime, Exif.Photo.OffsetTimeOriginal, Exif.Photo.OffsetTimeDigitized, Xmp.xmp.CreateDate, Xmp.xmp.ModifyDate, Xmp.xmp.MetadataDate, Xmp.photoshop.DateCreated of self.

New in version 3.0.

set_from_exif(exif_data)
Parameters:

exif_data (bytes) – The blob of Exif data to set

Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

Sets the tags from a piece of Exif data on self.

New in version 2.10.

set_from_iptc(iptc_data)
Parameters:

iptc_data (bytes) – The blob of Iptc data to set

Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

Sets the tags from a piece of IPTC data on self.

New in version 2.10.

set_from_xmp(xmp_data)
Parameters:

xmp_data (bytes) – The blob of XMP data to set

Raises:

GLib.Error

Returns:

True on success, False otherwise.

Return type:

bool

Sets the tags from a piece of XMP data on self.

New in version 2.10.

set_pixel_size(width, height)
Parameters:
  • width (int) – Width in pixels

  • height (int) – Height in pixels

Sets Exif.Image.ImageWidth and Exif.Image.ImageLength on self. If already present, also sets Exif.Photo.PixelXDimension and Exif.Photo.PixelYDimension.

New in version 2.10.

set_resolution(xres, yres, unit)
Parameters:
  • xres (float) – The image’s X Resolution, in ppi

  • yres (float) – The image’s Y Resolution, in ppi

  • unit (Gimp.Unit) – The image’s unit

Sets Exif.Image.XResolution, Exif.Image.YResolution and Exif.Image.ResolutionUnit of self.

New in version 2.10.