## GimpMetadata GimpMetadata — Basic functions for handling GimpMetadata objects. |

## Functions

GimpMetadata * | gimp_metadata_new ()
GimpMetadata * | gimp_metadata_duplicate ()
GimpMetadata * | gimp_metadata_deserialize ()
gchar * | gimp_metadata_serialize ()
gchar * | gimp_metadata_get_guid ()
void | gimp_metadata_add_xmp_history ()
GimpMetadata * | gimp_metadata_load_from_file ()
gboolean | gimp_metadata_save_to_file ()
gboolean | gimp_metadata_set_from_exif ()
gboolean | gimp_metadata_set_from_iptc ()
gboolean | gimp_metadata_set_from_xmp ()
void | gimp_metadata_set_pixel_size ()
void | gimp_metadata_set_bits_per_sample ()
gboolean | gimp_metadata_get_resolution ()
void | gimp_metadata_set_resolution ()
GimpMetadataColorspace | gimp_metadata_get_colorspace ()
void | gimp_metadata_set_colorspace ()
gboolean | gimp_metadata_is_tag_supported ()

## Types and Values

| GimpMetadata
enum | GimpMetadataLoadFlags
enum | GimpMetadataSaveFlags
enum | GimpMetadataColorspace

## Description

Basic functions for handling GimpMetadata objects.

## Functions

### gimp_metadata_new ()

    GimpMetadata *
    gimp_metadata_new (void);

Creates a new GimpMetadata instance.

#### Returns

The new GimpMetadata.

Since: 2.10

### gimp_metadata_duplicate ()

    GimpMetadata *
    gimp_metadata_duplicate (GimpMetadata *metadata);

Duplicates a GimpMetadata instance.

#### Parameters

metadata | The object to duplicate, or `NULL`. |

#### Returns

The new GimpMetadata, or `NULL` if `metadata` is `NULL`.

Since: 2.10

### gimp_metadata_deserialize ()

    GimpMetadata *
    gimp_metadata_deserialize (const gchar *metadata_xml);

Deserializes a string of XML that has been created by `gimp_metadata_serialize()`.

#### Parameters

metadata_xml | A string of serialized metadata XML. |

#### Returns

The new GimpMetadata.

Since: 2.10

### gimp_metadata_serialize ()

    gchar *
    gimp_metadata_serialize (GimpMetadata *metadata);

Serializes `metadata` into an XML string that can later be deserialized using `gimp_metadata_deserialize()`.

#### Parameters

metadata | A GimpMetadata instance. |

#### Returns

The serialized XML string.

Since: 2.10

### gimp_metadata_get_guid ()

    gchar *
    gimp_metadata_get_guid (void);

Generate Version 4 UUID/GUID.

#### Returns

The new GUID/UUID string.

Since: 2.10

### gimp_metadata_add_xmp_history ()

    void
    gimp_metadata_add_xmp_history (GimpMetadata *metadata,
                                   gchar *state_status);

### gimp_metadata_load_from_file ()

    GimpMetadata *
    gimp_metadata_load_from_file (GFile *file,
                                  GError **error);

Loads GimpMetadata from `file` .

#### Parameters

file | The GFile to load the metadata from |
error | Return location for error message |

#### Returns

The loaded GimpMetadata.

Since: 2.10

### gimp_metadata_save_to_file ()

    gboolean
    gimp_metadata_save_to_file (GimpMetadata *metadata,
                                GFile *file,
                                GError **error);

Saves `metadata` to `file` .

#### Parameters

metadata | A GimpMetadata instance. |
file | The file to save the metadata to |
error | Return location for error message |

#### Returns

`TRUE` on success, `FALSE` otherwise.

Since: 2.10

### gimp_metadata_set_from_exif ()

    gboolean
    gimp_metadata_set_from_exif (GimpMetadata *metadata,
                                 const guchar *exif_data,
                                 gint exif_data_length,
                                 GError **error);

Sets the tags from a piece of Exif data on `metadata` .

#### Parameters

metadata | A GimpMetadata instance. |
exif_data | The blob of Exif data to set |
exif_data_length | Length of `exif_data` , in bytes |
error | Return location for error message |

#### Returns

`TRUE` on success, `FALSE` otherwise.

Since: 2.10

### gimp_metadata_set_from_iptc ()

    gboolean
    gimp_metadata_set_from_iptc (GimpMetadata *metadata,
                                 const guchar *iptc_data,
                                 gint iptc_data_length,
                                 GError **error);

Sets the tags from a piece of IPTC data on `metadata` .

#### Parameters

metadata | A GimpMetadata instance. |
iptc_data | The blob of Ipc data to set |
iptc_data_length | Length of `iptc_data` , in bytes |
error | Return location for error message |

#### Returns

`TRUE` on success, `FALSE` otherwise.

Since: 2.10

### gimp_metadata_set_from_xmp ()

    gboolean
    gimp_metadata_set_from_xmp (GimpMetadata *metadata,
                                const guchar *xmp_data,
                                gint xmp_data_length,
                                GError **error);

Sets the tags from a piece of XMP data on `metadata` .

#### Parameters

metadata | A GimpMetadata instance. |
xmp_data | The blob of Exif data to set |
xmp_data_length | Length of `exif_data` , in bytes |
error | Return location for error message |

#### Returns

`TRUE` on success, `FALSE` otherwise.

Since: 2.10

### gimp_metadata_set_pixel_size ()

    void
    gimp_metadata_set_pixel_size (GimpMetadata *metadata,
                                  gint width,
                                  gint height);

Sets Exif.Image.ImageWidth and Exif.Image.ImageLength on `metadata` .

#### Parameters

metadata | A GimpMetadata instance. |
width | Width in pixels |
height | Height in pixels |

Since: 2.10

### gimp_metadata_set_bits_per_sample ()

    void
    gimp_metadata_set_bits_per_sample (GimpMetadata *metadata,
                                       gint bits_per_sample);

Sets Exif.Image.BitsPerSample on `metadata` .

#### Parameters

metadata | A GimpMetadata instance. |
bits_per_sample | Bits per pixel, per component |

Since: 2.10

### gimp_metadata_get_resolution ()

    gboolean
    gimp_metadata_get_resolution (GimpMetadata *metadata,
                                  gdouble *xres,
                                  gdouble *yres,
                                  GimpUnit *unit);

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

#### Parameters

metadata | A GimpMetadata instance. |
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 |

#### Returns

`TRUE` on success, `FALSE` otherwise.

Since: 2.10

### gimp_metadata_set_resolution ()

    void
    gimp_metadata_set_resolution (GimpMetadata *metadata,
                                  gdouble xres,
                                  gdouble yres,
                                  GimpUnit unit);

Sets Exif.Image.XResolution, Exif.Image.YResolution and Exif.Image.ResolutionUnit of `metadata` .

#### Parameters

metadata | A GimpMetadata instance. |
xres | The image's X Resolution, in ppi |
yres | The image's Y Resolution, in ppi |
unit | The image's unit |

Since: 2.10

### gimp_metadata_get_colorspace ()

    GimpMetadataColorspace
    gimp_metadata_get_colorspace (GimpMetadata *metadata);

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

#### Parameters

metadata | A GimpMetadata instance. |

#### Returns

The colorspace specified by above tags.

Since: 2.10

### gimp_metadata_set_colorspace ()

    void
    gimp_metadata_set_colorspace (GimpMetadata *metadata,
                                  GimpMetadataColorspace colorspace);

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

#### Parameters

metadata | A GimpMetadata instance. |
colorspace | The color space. |

Since: 2.10

### gimp_metadata_is_tag_supported ()

    gboolean
    gimp_metadata_is_tag_supported (const gchar *tag,
                                    const gchar *mime_type);

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

#### Parameters

tag | A metadata tag name |
mime_type | A mime type |

#### Returns

`TRUE` if the `tag` supported with `mime_type` , `FALSE` otherwise.

Since: 2.10

## Types and Values

### GimpMetadata

    typedef struct _GimpMetadata GimpMetadata;

### enum GimpMetadataLoadFlags

What metadata to load when importing images.

#### Members

GIMP_METADATA_LOAD_COMMENT | Load the comment |
GIMP_METADATA_LOAD_RESOLUTION | Load the resolution |
GIMP_METADATA_LOAD_ORIENTATION | Load the orientation (rotation) |
GIMP_METADATA_LOAD_COLORSPACE | Load the colorspace |
GIMP_METADATA_LOAD_ALL | Load all of the above |

### enum GimpMetadataSaveFlags

What kinds of metadata to save when exporting images.

#### Members

GIMP_METADATA_SAVE_EXIF | Save EXIF |
GIMP_METADATA_SAVE_XMP | Save XMP |
GIMP_METADATA_SAVE_IPTC | Save IPTC |
GIMP_METADATA_SAVE_THUMBNAIL | Save a thumbnail of the image |
GIMP_METADATA_SAVE_COLOR_PROFILE | Save the image's color profile Since: 2.10.10 |
GIMP_METADATA_SAVE_ALL | Save all of the above |

### enum GimpMetadataColorspace

Well-defined colorspace information available from metadata

#### Members

GIMP_METADATA_COLORSPACE_UNSPECIFIED | Unspecified |
GIMP_METADATA_COLORSPACE_UNCALIBRATED | Uncalibrated |
GIMP_METADATA_COLORSPACE_SRGB | sRGB |
GIMP_METADATA_COLORSPACE_ADOBERGB | Adobe RGB |

## See Also

gimp_image_metadata_load_prepare(), `gimp_image_metadata_load_finish()`, `gimp_image_metadata_save_prepare()`, `gimp_image_metadata_save_finish()`.