## 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 ()
GimpMetadata * | gimp_metadata_load_from_file ()
gboolean | gimp_metadata_save_to_file ()
gboolean | gimp_metadata_set_from_exif ()
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 ()
gboolean | gimp_metadata_is_tag_supported ()

## Types and Values

typedef | GimpMetadata
enum | GimpMetadataLoadFlags
enum | GimpMetadataSaveFlags

## 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_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_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_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 _GExiv2Metadata GimpMetadata;

### enum GimpMetadataLoadFlags

#### Members

GIMP_METADATA_LOAD_COMMENT |  |
GIMP_METADATA_LOAD_RESOLUTION |  |
GIMP_METADATA_LOAD_ORIENTATION |  |
GIMP_METADATA_LOAD_COLORSPACE |  |
GIMP_METADATA_LOAD_ALL |  |

### enum GimpMetadataSaveFlags

#### Members

GIMP_METADATA_SAVE_EXIF |  |
GIMP_METADATA_SAVE_XMP |  |
GIMP_METADATA_SAVE_IPTC |  |
GIMP_METADATA_SAVE_THUMBNAIL |  |
GIMP_METADATA_SAVE_ALL |  |

## See Also

gimp_image_metadata_load_prepare(), `gimp_image_metadata_load_finish()`, `gimp_image_metadata_load_prepare()`, `gimp_image_metadata_load_finish()`.