Package: mirage / 0.9.5.2-1

save-exif.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Description: Keep EXIF/IPTC/XMP tags after modification (Closes #513025)
Author: Thomas Ross <th0m4sr0ss@gmail.com>
Last-Update: 2015-07-22
--- a/mirage.py
+++ b/mirage.py
@@ -30,6 +30,7 @@
 import random, urllib, gobject, gettext, locale
 import stat, time, subprocess, shutil, filecmp
 import tempfile, socket, threading
+import pyexiv2
 try:
 	import hashlib
 	HAS_HASHLIB = True
@@ -1670,8 +1671,14 @@
 			if filetype == None:
 				filetype = gtk.gdk.pixbuf_get_file_info(self.currimg_name)[0]['name']
 			if self.filetype_is_writable(filetype):
+				old_metadata = pyexiv2.ImageMetadata(self.currimg_name)
+				old_metadata.read()
 				self.currimg_pixbuf_original.save(dest_name, filetype, {'quality': str(self.quality_save)})
 				self.currimg_name = dest_name
+				new_metadata = pyexiv2.ImageMetadata(dest_name)
+				new_metadata.read()
+				old_metadata.copy(new_metadata)
+				new_metadata.write()
 				self.image_list[self.curr_img_in_list] = dest_name
 				self.update_title()
 				self.update_statusbar()