summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatiargs2024-07-18 15:04:24 +0000
committerjvoisin2024-07-18 15:04:24 +0000
commit75c0a750c1b520bac276fd84e7fa4106e7f975f8 (patch)
tree9141f4feecf87402f328b4669e120122c9aa3813
parenta47ac01eb626859fda3a25996ed3d9665f6001fe (diff)
Keep orientation metadata
-rw-r--r--CHANGELOG.md3
-rw-r--r--libmat2/images.py5
-rw-r--r--pyproject.toml2
-rw-r--r--setup.py2
-rw-r--r--tests/test_lightweight_cleaning.py1
5 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 50b4b72..50d99c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
1# 0.13.5 - 2023-08-02
2- Keep orientation metadata on jpeg and tiff files
3
1# 0.13.4 - 2023-08-02 4# 0.13.4 - 2023-08-02
2 5
3- Add documentation about mat2 on OSX 6- Add documentation about mat2 on OSX
diff --git a/libmat2/images.py b/libmat2/images.py
index 254438b..bca1e74 100644
--- a/libmat2/images.py
+++ b/libmat2/images.py
@@ -116,6 +116,7 @@ class GdkPixbufAbstractParser(exiftool.ExiftoolParser):
116 116
117 _, extension = os.path.splitext(self.filename) 117 _, extension = os.path.splitext(self.filename)
118 pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.filename) 118 pixbuf = GdkPixbuf.Pixbuf.new_from_file(self.filename)
119 pixbuf = GdkPixbuf.Pixbuf.apply_embedded_orientation(pixbuf)
119 if extension.lower() == '.jpg': 120 if extension.lower() == '.jpg':
120 extension = '.jpeg' # gdk is picky 121 extension = '.jpeg' # gdk is picky
121 elif extension.lower() == '.tif': 122 elif extension.lower() == '.tif':
@@ -138,7 +139,7 @@ class JPGParser(GdkPixbufAbstractParser):
138 'MIMEType', 'ImageWidth', 'ImageSize', 'BitsPerSample', 139 'MIMEType', 'ImageWidth', 'ImageSize', 'BitsPerSample',
139 'ColorComponents', 'EncodingProcess', 'JFIFVersion', 140 'ColorComponents', 'EncodingProcess', 'JFIFVersion',
140 'ResolutionUnit', 'XResolution', 'YCbCrSubSampling', 141 'ResolutionUnit', 'XResolution', 'YCbCrSubSampling',
141 'YResolution', 'Megapixels', 'ImageHeight'} 142 'YResolution', 'Megapixels', 'ImageHeight', 'Orientation'}
142 143
143 144
144class TiffParser(GdkPixbufAbstractParser): 145class TiffParser(GdkPixbufAbstractParser):
@@ -152,7 +153,7 @@ class TiffParser(GdkPixbufAbstractParser):
152 'FileInodeChangeDate', 'FileModifyDate', 'FileName', 153 'FileInodeChangeDate', 'FileModifyDate', 'FileName',
153 'FilePermissions', 'FileSize', 'FileType', 154 'FilePermissions', 'FileSize', 'FileType',
154 'FileTypeExtension', 'ImageHeight', 'ImageSize', 155 'FileTypeExtension', 'ImageHeight', 'ImageSize',
155 'ImageWidth', 'MIMEType', 'Megapixels', 'SourceFile'} 156 'ImageWidth', 'MIMEType', 'Megapixels', 'SourceFile', 'Orientation'}
156 157
157 158
158class PPMParser(abstract.AbstractParser): 159class PPMParser(abstract.AbstractParser):
diff --git a/pyproject.toml b/pyproject.toml
index a52ee41..62912b1 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
1[project] 1[project]
2name = "mat2" 2name = "mat2"
3version = "0.13.4" 3version = "0.13.5"
4description = "mat2 is a metadata removal tool, supporting a wide range of commonly used file formats, written in python3: at its core, it's a library, used by an eponymous command-line interface, as well as several file manager extensions." 4description = "mat2 is a metadata removal tool, supporting a wide range of commonly used file formats, written in python3: at its core, it's a library, used by an eponymous command-line interface, as well as several file manager extensions."
5readme = "README.md" 5readme = "README.md"
6license = {file = "LICENSE"} 6license = {file = "LICENSE"}
diff --git a/setup.py b/setup.py
index bbdf1d9..d8972fd 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ with open("README.md", encoding='utf-8') as fh:
5 5
6setuptools.setup( 6setuptools.setup(
7 name="mat2", 7 name="mat2",
8 version='0.13.4', 8 version='0.13.5',
9 author="Julien (jvoisin) Voisin", 9 author="Julien (jvoisin) Voisin",
10 author_email="julien.voisin+mat2@dustri.org", 10 author_email="julien.voisin+mat2@dustri.org",
11 description="A handy tool to trash your metadata", 11 description="A handy tool to trash your metadata",
diff --git a/tests/test_lightweight_cleaning.py b/tests/test_lightweight_cleaning.py
index 38e06dc..ce7e48c 100644
--- a/tests/test_lightweight_cleaning.py
+++ b/tests/test_lightweight_cleaning.py
@@ -33,7 +33,6 @@ class TestLightWeightCleaning(unittest.TestCase):
33 'parser': images.TiffParser, 33 'parser': images.TiffParser,
34 'meta': {'ImageDescription': 'OLYMPUS DIGITAL CAMERA '}, 34 'meta': {'ImageDescription': 'OLYMPUS DIGITAL CAMERA '},
35 'expected_meta': { 35 'expected_meta': {
36 'Orientation': 'Horizontal (normal)',
37 'ResolutionUnit': 'inches', 36 'ResolutionUnit': 'inches',
38 'XResolution': 72, 37 'XResolution': 72,
39 'YResolution': 72 38 'YResolution': 72