diff options
| author | jvoisin | 2023-01-14 15:38:12 +0100 |
|---|---|---|
| committer | jvoisin | 2023-01-14 15:38:12 +0100 |
| commit | 1f73a16ef36d1a8e771a0b3695818d18e095486b (patch) | |
| tree | f82d16f8bd7e6b78b7c5b1909c1b7284c95e132a /libmat2/images.py | |
| parent | e8b38f110127aa507c1c6bb0f62cfb750872e468 (diff) | |
imghdr is deprecated
Diffstat (limited to 'libmat2/images.py')
| -rw-r--r-- | libmat2/images.py | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/libmat2/images.py b/libmat2/images.py index 37ed36c..083ff64 100644 --- a/libmat2/images.py +++ b/libmat2/images.py | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | import imghdr | ||
| 2 | import os | 1 | import os |
| 3 | import re | 2 | import re |
| 4 | from typing import Union, Any | 3 | from typing import Union, Any |
| @@ -71,9 +70,6 @@ class PNGParser(exiftool.ExiftoolParser): | |||
| 71 | def __init__(self, filename): | 70 | def __init__(self, filename): |
| 72 | super().__init__(filename) | 71 | super().__init__(filename) |
| 73 | 72 | ||
| 74 | if imghdr.what(filename) != 'png': | ||
| 75 | raise ValueError | ||
| 76 | |||
| 77 | try: # better fail here than later | 73 | try: # better fail here than later |
| 78 | cairo.ImageSurface.create_from_png(self.filename) | 74 | cairo.ImageSurface.create_from_png(self.filename) |
| 79 | except: # pragma: no cover | 75 | except: # pragma: no cover |
| @@ -111,7 +107,6 @@ class GdkPixbufAbstractParser(exiftool.ExiftoolParser): | |||
| 111 | 107 | ||
| 112 | def __init__(self, filename): | 108 | def __init__(self, filename): |
| 113 | super().__init__(filename) | 109 | super().__init__(filename) |
| 114 | # we can't use imghdr here because of https://bugs.python.org/issue28591 | ||
| 115 | try: | 110 | try: |
| 116 | GdkPixbuf.Pixbuf.new_from_file(self.filename) | 111 | GdkPixbuf.Pixbuf.new_from_file(self.filename) |
| 117 | except GLib.GError: | 112 | except GLib.GError: |
