From: Fredrik Unger Date: Tue, 22 Jan 2019 19:47:03 +0000 (+0100) Subject: image: improving xmp support X-Git-Url: https://source.tree.se/git?p=treecutter.git;a=commitdiff_plain;h=5ee26cbf373af8fe76d549f4f1cba1f240146a2b image: improving xmp support Adding some new support for writing resized files, pusing the caption to thouse files. Returning if False if xmp is missing. --- diff --git a/treecutter/image.py b/treecutter/image.py index d031e26..6136a0d 100644 --- a/treecutter/image.py +++ b/treecutter/image.py @@ -51,6 +51,12 @@ class Image(): if retcode: print 'Error: '+' '.join(cmd)+' Returncode ['+str(retcode)+']' exit + else: + cmd = ['exiftool', '-XMP:CreatorTool=treecutter','-quiet','-overwrite_original', outfile] + retcode = subprocess.call(cmd) + if retcode: + print 'Error: '+' '.join(cmd)+' Returncode ['+str(retcode)+']' + exit xmpfile.close_file() self._format[size] = outfile return outfile @@ -58,6 +64,8 @@ class Image(): def generated(self): xmpfile = XMPFiles(file_path=self._filename) xmp = xmpfile.get_xmp() + if not xmp: + return False cr = None if xmp.does_property_exist(consts.XMP_NS_XMP, u'CreatorTool'): cr = xmp.get_property(consts.XMP_NS_XMP, u'CreatorTool')