Functions related to XMP metadata: gexiv2 Reference Manual

## Functions related to XMP metadata Functions related to XMP metadata — Functionality specific to the XMP familiy of metadata information |

## Functions

gboolean | gexiv2_metadata_is_xmp_tag ()
gboolean | gexiv2_metadata_get_supports_xmp ()
gboolean | gexiv2_metadata_has_xmp ()
gboolean | gexiv2_metadata_try_set_xmp_tag_struct ()
void | gexiv2_metadata_clear_xmp ()
gchar * | gexiv2_metadata_try_generate_xmp_packet ()
gchar * | gexiv2_metadata_try_get_xmp_packet ()
gchar ** | gexiv2_metadata_get_xmp_tags ()
gboolean | gexiv2_metadata_try_register_xmp_namespace ()
gboolean | gexiv2_metadata_try_unregister_xmp_namespace ()
void | gexiv2_metadata_try_unregister_all_xmp_namespaces ()
char * | gexiv2_metadata_try_get_xmp_namespace_for_tag ()
gchar * | gexiv2_metadata_get_xmp_packet ()
gboolean | gexiv2_metadata_register_xmp_namespace ()
gboolean | gexiv2_metadata_unregister_xmp_namespace ()
void | gexiv2_metadata_unregister_all_xmp_namespaces ()
char * | gexiv2_metadata_get_xmp_namespace_for_tag ()
gchar * | gexiv2_metadata_generate_xmp_packet ()
gboolean | gexiv2_metadata_set_xmp_tag_struct ()

## Types and Values

enum | GExiv2XmpFormatFlags

## Object Hierarchy

        GFlags
        ╰── GExiv2XmpFormatFlags

## Includes

    #include <gexiv2/gexiv2.h>

## Description

While being part of GExiv2Metadata, these functions are dealing with specific aspects of XMP

## Functions

### gexiv2_metadata_is_xmp_tag ()

    gboolean
    gexiv2_metadata_is_xmp_tag (const gchar *tag);

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html

#### Parameters

tag | An Exiv2 tag |

#### Returns

TRUE if the Exiv2 tag is for the XMP domain.

### gexiv2_metadata_get_supports_xmp ()

    gboolean
    gexiv2_metadata_get_supports_xmp (GExiv2Metadata *self);

Query `self` whether it supports writing XMP metadata.

#### Parameters

self | An instance of GExiv2Metadata |

#### Returns

`TRUE` if the loaded image type supports writing XMP metadata.

### gexiv2_metadata_has_xmp ()

    gboolean
    gexiv2_metadata_has_xmp (GExiv2Metadata *self);

#### Parameters

self | An instance of GExiv2Metadata |

#### Returns

TRUE if XMP metadata is present in the loaded image

### gexiv2_metadata_try_set_xmp_tag_struct ()

    gboolean
    gexiv2_metadata_try_set_xmp_tag_struct
                                   (GExiv2Metadata *self,
                                    const gchar *tag,
                                    GExiv2StructureType type,
                                    GError **error);

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html

#### Parameters

self | An instance of GExiv2Metadata |
tag | Exiv2 tag name |
type | The GExiv2StructureType specifying the type of structure |
error | A return location for a GError or `NULL`. | [allow-none]

#### Returns

TRUE on success

Since: 0.12.2

### gexiv2_metadata_clear_xmp ()

    void
    gexiv2_metadata_clear_xmp (GExiv2Metadata *self);

Clears all XMP metadata from the loaded image.

#### Parameters

self | An instance of GExiv2Metadata |

### gexiv2_metadata_try_generate_xmp_packet ()

    gchar *
    gexiv2_metadata_try_generate_xmp_packet
                                   (GExiv2Metadata *self,
                                    GExiv2XmpFormatFlags xmp_format_flags,
                                    guint32 padding,
                                    GError **error);

Encode the XMP packet as a `NULL`-terminated string.

#### Parameters

self | An instance of GExiv2Metadata |
xmp_format_flags | One of GExiv2XmpFormatFlags |
padding | The padding (FIXME: Add documentation) |
error | A return location for a GError or `NULL`. | [allow-none]

#### Returns

Encode the XMP packet and return as a `NULL`-terminated string.

[transfer full][allow-none]

Since: 0.12.2

### gexiv2_metadata_try_get_xmp_packet ()

    gchar *
    gexiv2_metadata_try_get_xmp_packet (GExiv2Metadata *self,
                                        GError **error);

#### Parameters

self | An instance of GExiv2Metadata |
error | A return location for a GError or `NULL`. | [allow-none]

#### Returns

The currently-encoded XMP packet (see gexiv2_metadata_generate_xmp_packet).

[transfer full][allow-none]

Since: 0.12.2

### gexiv2_metadata_get_xmp_tags ()

    gchar **
    gexiv2_metadata_get_xmp_tags (GExiv2Metadata *self);

#### Parameters

self | An instance of GExiv2Metadata |

#### Returns

A unique list of the available XMP tags.

[transfer full][array zero-terminated=1]

### gexiv2_metadata_try_register_xmp_namespace ()

    gboolean
    gexiv2_metadata_try_register_xmp_namespace
                                   (const gchar *name,
                                    const gchar *prefix,
                                    GError **error);

#### Parameters

name | XMP URI name (should end in /). | [in]
prefix | XMP namespace prefix. | [in]
error | A return location for a GError or `NULL`. | [allow-none]

#### Returns

Boolean success value.

[skip]

Since: 0.14.0

### gexiv2_metadata_try_unregister_xmp_namespace ()

    gboolean
    gexiv2_metadata_try_unregister_xmp_namespace
                                   (const gchar *name,
                                    GError **error);

#### Parameters

name | XMP URI name (should end in /). | [in]
error | A return location for a GError or `NULL`. | [allow-none]

#### Returns

Boolean success value.

[skip]

Since: 0.14.0

### gexiv2_metadata_try_unregister_all_xmp_namespaces ()

    void
    gexiv2_metadata_try_unregister_all_xmp_namespaces
                                   (GError **error);

#### Parameters

error | A return location for a GError or `NULL`. | [allow-none]

Since: 0.14.0

### gexiv2_metadata_try_get_xmp_namespace_for_tag ()

    char *
    gexiv2_metadata_try_get_xmp_namespace_for_tag
                                   (const char *tag,
                                    GError **error);

#### Parameters

tag | Full tag name (e.g. "Xmp.dc.subject") or XMP namespace identifier (e.g. "dc"). | [in]
error | A return location for a GError or `NULL`. | [allow-none]

#### Returns

`NULL` if there was no namespace registered for the tag, the URI of the namespace otherwise.

[transfer full]

Since: 0.14.0

### gexiv2_metadata_get_xmp_packet ()

    gchar *
    gexiv2_metadata_get_xmp_packet (GExiv2Metadata *self);

`gexiv2_metadata_get_xmp_packet` has been deprecated since version 0.12.2 and should not be used in newly-written code.

Use `gexiv2_metadata_try_get_xmp_packet()` instead.

#### Parameters

self | An instance of GExiv2Metadata |

#### Returns

The currently-encoded XMP packet (see gexiv2_metadata_generate_xmp_packet).

[transfer full][allow-none]

### gexiv2_metadata_register_xmp_namespace ()

    gboolean
    gexiv2_metadata_register_xmp_namespace
                                   (const gchar *name,
                                    const gchar *prefix);

`gexiv2_metadata_register_xmp_namespace` has been deprecated since version 0.14.0 and should not be used in newly-written code.

Use `gexiv2_metadata_try_register_xmp_namespace()` instead.

#### Parameters

name | XMP URI name (should end in /). | [in]
prefix | XMP namespace prefix. | [in]

#### Returns

Boolean success value.

[skip]

### gexiv2_metadata_unregister_xmp_namespace ()

    gboolean
    gexiv2_metadata_unregister_xmp_namespace
                                   (const gchar *name);

`gexiv2_metadata_unregister_xmp_namespace` has been deprecated since version 0.14.0 and should not be used in newly-written code.

Use `gexiv2_metadata_try_unregister_xmp_namespace()` instead.

#### Parameters

name | XMP URI name (should end in /). | [in]

#### Returns

Boolean success value.

[skip]

### gexiv2_metadata_unregister_all_xmp_namespaces ()

    void
    gexiv2_metadata_unregister_all_xmp_namespaces
                                   (void);

`gexiv2_metadata_unregister_all_xmp_namespaces` has been deprecated since version 0.14.0 and should not be used in newly-written code.

Use `gexiv2_metadata_try_unregister_all_xmp_namespaces()` instead.

### gexiv2_metadata_get_xmp_namespace_for_tag ()

    char *
    gexiv2_metadata_get_xmp_namespace_for_tag
                                   (const char *tag);

`gexiv2_metadata_get_xmp_namespace_for_tag` has been deprecated since version 0.14.0 and should not be used in newly-written code.

Use `gexiv2_metadata_try_get_xmp_namespace_for_tag()` instead.

#### Parameters

tag | Full tag name (e.g. "Xmp.dc.subject") or XMP namespace identifier (e.g. "dc"). | [in]

#### Returns

`NULL` if there was no namespace registered for the tag, the URI of the namespace otherwise.

[transfer full]

Since: 0.12.2

### gexiv2_metadata_generate_xmp_packet ()

    gchar *
    gexiv2_metadata_generate_xmp_packet (GExiv2Metadata *self,
                                         GExiv2XmpFormatFlags xmp_format_flags,
                                         guint32 padding);

`gexiv2_metadata_generate_xmp_packet` has been deprecated since version 0.12.2 and should not be used in newly-written code.

Use `gexiv2_metadata_try_generate_xmp_packet()` instead.

Encode the XMP packet as a `NULL`-terminated string.

#### Parameters

self | An instance of GExiv2Metadata |
xmp_format_flags | One of GExiv2XmpFormatFlags |
padding | The padding (FIXME: Add documentation) |

#### Returns

Encode the XMP packet and return as a `NULL`-terminated string.

[transfer full][allow-none]

### gexiv2_metadata_set_xmp_tag_struct ()

    gboolean
    gexiv2_metadata_set_xmp_tag_struct (GExiv2Metadata *self,
                                        const gchar *tag,
                                        GExiv2StructureType type);

`gexiv2_metadata_set_xmp_tag_struct` has been deprecated since version 0.12.2 and should not be used in newly-written code.

Use `gexiv2_metadata_try_set_xmp_tag_struct()` instead.

The Exiv2 Tag Reference can be found at http://exiv2.org/metadata.html

#### Parameters

self | An instance of GExiv2Metadata |
tag | Exiv2 tag name |
type | The GExiv2StructureType specifying the type of structure |

#### Returns

TRUE on success

## Types and Values

### enum GExiv2XmpFormatFlags

Options to control the format of the serialized XMP packet Taken from: exiv2/src/xmp.hpp

#### Members

GEXIV2_OMIT_PACKET_WRAPPER | Omit the XML packet wrapper. |
GEXIV2_READ_ONLY_PACKET | Default is a writeable packet. |
GEXIV2_USE_COMPACT_FORMAT | Use a compact form of RDF. |
GEXIV2_INCLUDE_THUMBNAIL_PAD | Include a padding allowance for a thumbnail image. |
GEXIV2_EXACT_PACKET_LENGTH | The padding parameter is the overall packet length. |
GEXIV2_WRITE_ALIAS_COMMENTS | Show aliases as XML comments. |
GEXIV2_OMIT_ALL_FORMATTING | Omit all formatting whitespace. |