+gchar *comment_key = "Xmp.dc.description";
+gchar *keyword_key = "Xmp.dc.subject";
+
+static gint comment_xmp_read(FileData *fd, GList **keywords, gchar **comment)
+{
+ ExifData *exif = exif_read_fd(fd, FALSE);
+ if (!exif) return FALSE;
+
+ if (comment)
+ {
+ ExifItem *item = exif_get_item(exif, comment_key);
+ *comment = exif_item_get_string(item, 0);
+ }
+
+ if (keywords)
+ {
+ ExifItem *item = exif_get_item(exif, keyword_key);
+ int count = exif_item_get_elements(item);
+ int i = 0;
+ GList *work = NULL;
+ char *kw = NULL;
+
+ while (i < count && (kw = exif_item_get_string(item, i++)))
+ {
+ work = g_list_append(work, (gpointer) kw);
+ }
+
+ *keywords = work;
+ }
+
+ exif_free(exif);
+ return TRUE;
+}
+
+static gint comment_xmp_write(FileData *fd, GList *keywords, const gchar *comment)
+{
+ gint success = FALSE;
+ GList *work = keywords;
+ ExifData *exif = exif_read_fd(fd, FALSE);
+ if (!exif) return FALSE;
+
+ ExifItem *item = exif_get_item(exif, comment_key);
+
+ if (item && !(comment && comment[0]))
+ {
+ exif_item_delete(exif, item);
+ item = NULL;
+ }
+
+ if (!item && comment && comment[0]) item = exif_add_item(exif, comment_key);
+ if (item) exif_item_set_string(item, comment);
+
+
+
+ while ((item = exif_get_item(exif, keyword_key)))
+ {
+ exif_item_delete(exif, item);
+ }
+
+ if (work)
+ {
+ item = exif_add_item(exif, keyword_key);
+
+ while (work)
+ {
+ gchar *kw = (gchar *) work->data;
+ work = work->next;
+
+ exif_item_set_string(item, kw);
+ }
+ }
+
+ success = exif_write(exif);
+
+ exif_free(exif);
+
+ return success;
+}
+
+gint comment_write(FileData *fd, GList *keywords, const gchar *comment)
+{
+ if (comment_xmp_write(fd, keywords, comment)) return TRUE;
+
+ return comment_legacy_write(fd, keywords, comment);
+}
+
+gint comment_read(FileData *fd, GList **keywords, gchar **comment)
+{
+ if (comment_xmp_read(fd, keywords, comment)) return TRUE;
+
+ return comment_legacy_read(fd, keywords, comment);
+}
+
+