diff --git a/entity/image_container.py b/entity/image_container.py index 7fdc377..a049868 100644 --- a/entity/image_container.py +++ b/entity/image_container.py @@ -241,4 +241,9 @@ def save(self, target_path, quality=100): if self.watermark_img.mode != 'RGB': self.watermark_img = self.watermark_img.convert('RGB') - self.watermark_img.save(target_path, quality=quality, encoding='utf-8', exif=self.img.info['exif']) + + if 'exif' in self.img.info: + self.watermark_img.save(target_path, quality=quality, encoding='utf-8', + exif=self.img.info['exif'] if 'exif' in self.img.info else '') + else: + self.watermark_img.save(target_path, quality=quality, encoding='utf-8')