pillow-avif-plugin 1.4.0__cp310-cp310-musllinux_1_1_x86_64.whl → 1.4.2__cp310-cp310-musllinux_1_1_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pillow-avif-plugin might be problematic. Click here for more details.
- pillow_avif/AvifImagePlugin.py +24 -18
- pillow_avif/__init__.py +1 -1
- pillow_avif/_avif.cpython-310-x86_64-linux-gnu.so +0 -0
- {pillow_avif_plugin-1.4.0.dist-info → pillow_avif_plugin-1.4.2.dist-info}/METADATA +1 -1
- pillow_avif_plugin-1.4.2.dist-info/RECORD +10 -0
- {pillow_avif_plugin-1.4.0.dist-info → pillow_avif_plugin-1.4.2.dist-info}/WHEEL +1 -1
- pillow_avif_plugin-1.4.0.dist-info/RECORD +0 -10
- {pillow_avif_plugin-1.4.0.dist-info → pillow_avif_plugin-1.4.2.dist-info}/LICENSE +0 -0
- {pillow_avif_plugin-1.4.0.dist-info → pillow_avif_plugin-1.4.2.dist-info}/top_level.txt +0 -0
- {pillow_avif_plugin-1.4.0.dist-info → pillow_avif_plugin-1.4.2.dist-info}/zip-safe +0 -0
pillow_avif/AvifImagePlugin.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import division
|
|
|
3
3
|
from io import BytesIO
|
|
4
4
|
import sys
|
|
5
5
|
|
|
6
|
-
from PIL import Image, ImageFile
|
|
6
|
+
from PIL import ExifTags, Image, ImageFile
|
|
7
7
|
|
|
8
8
|
try:
|
|
9
9
|
from pillow_avif import _avif
|
|
@@ -56,6 +56,9 @@ class AvifImageFile(ImageFile.ImageFile):
|
|
|
56
56
|
__loaded = -1
|
|
57
57
|
__frame = 0
|
|
58
58
|
|
|
59
|
+
def load_seek(self, pos):
|
|
60
|
+
pass
|
|
61
|
+
|
|
59
62
|
def _open(self):
|
|
60
63
|
self._decoder = _avif.AvifDecoder(
|
|
61
64
|
self.fp.read(), DECODE_CODEC_CHOICE, CHROMA_UPSAMPLING
|
|
@@ -126,23 +129,11 @@ def _save(im, fp, filename, save_all=False):
|
|
|
126
129
|
|
|
127
130
|
is_single_frame = total == 1
|
|
128
131
|
|
|
129
|
-
qmin = info.get("qmin")
|
|
130
|
-
qmax = info.get("qmax")
|
|
131
|
-
|
|
132
|
-
if
|
|
133
|
-
|
|
134
|
-
# to 63 (worst quality). If neither are explicitly specified, we use a 0-100
|
|
135
|
-
# quality scale (default 75) and calculate the qmin and qmax from that.
|
|
136
|
-
#
|
|
137
|
-
# - qmin is 0 for quality >= 64. Below that, qmin has an inverse linear
|
|
138
|
-
# relation to quality (i.e., quality 63 = qmin 1, quality 0 => qmin 63)
|
|
139
|
-
# - qmax is 0 for quality=100, then qmax increases linearly relative to
|
|
140
|
-
# quality decreasing, until it flattens out at quality=37.
|
|
141
|
-
quality = info.get("quality", 75)
|
|
142
|
-
if not isinstance(quality, int) or quality < 0 or quality > 100:
|
|
143
|
-
raise ValueError("Invalid quality setting")
|
|
144
|
-
qmin = max(0, min(64 - quality, 63))
|
|
145
|
-
qmax = max(0, min(100 - quality, 63))
|
|
132
|
+
qmin = info.get("qmin", -1)
|
|
133
|
+
qmax = info.get("qmax", -1)
|
|
134
|
+
quality = info.get("quality", 75)
|
|
135
|
+
if not isinstance(quality, int) or quality < 0 or quality > 100:
|
|
136
|
+
raise ValueError("Invalid quality setting")
|
|
146
137
|
|
|
147
138
|
duration = info.get("duration", 0)
|
|
148
139
|
subsampling = info.get("subsampling", "4:2:0")
|
|
@@ -158,6 +149,20 @@ def _save(im, fp, filename, save_all=False):
|
|
|
158
149
|
exif = info.get("exif", im.info.get("exif"))
|
|
159
150
|
if isinstance(exif, Image.Exif):
|
|
160
151
|
exif = exif.tobytes()
|
|
152
|
+
|
|
153
|
+
exif_orientation = 0
|
|
154
|
+
if exif:
|
|
155
|
+
exif_data = Image.Exif()
|
|
156
|
+
try:
|
|
157
|
+
exif_data.load(exif)
|
|
158
|
+
except SyntaxError:
|
|
159
|
+
pass
|
|
160
|
+
else:
|
|
161
|
+
orientation_tag = next(
|
|
162
|
+
k for k, v in ExifTags.TAGS.items() if v == "Orientation"
|
|
163
|
+
)
|
|
164
|
+
exif_orientation = exif_data.get(orientation_tag) or 0
|
|
165
|
+
|
|
161
166
|
xmp = info.get("xmp", im.info.get("xmp") or im.info.get("XML:com.adobe.xmp"))
|
|
162
167
|
|
|
163
168
|
if isinstance(xmp, text_type):
|
|
@@ -199,6 +204,7 @@ def _save(im, fp, filename, save_all=False):
|
|
|
199
204
|
autotiling,
|
|
200
205
|
icc_profile or b"",
|
|
201
206
|
exif or b"",
|
|
207
|
+
exif_orientation,
|
|
202
208
|
xmp or b"",
|
|
203
209
|
advanced,
|
|
204
210
|
)
|
pillow_avif/__init__.py
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pillow-avif-plugin
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.2
|
|
4
4
|
Summary: A pillow plugin that adds avif support via libavif
|
|
5
5
|
Home-page: https://github.com/fdintino/pillow-avif-plugin/
|
|
6
6
|
Download-URL: https://github.com/fdintino/pillow-avif-plugin/releases
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pillow_avif_plugin-1.4.2.dist-info/WHEEL,sha256=teAgl2hmEj-c3zIIL7kvmnJNpl7hVIar7x-kUOWAdXc,113
|
|
2
|
+
pillow_avif_plugin-1.4.2.dist-info/LICENSE,sha256=2l49eVdgaNy9JTEPbstz1GaaPKw02gFdtuThTNUi730,25213
|
|
3
|
+
pillow_avif_plugin-1.4.2.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
pillow_avif_plugin-1.4.2.dist-info/RECORD,,
|
|
5
|
+
pillow_avif_plugin-1.4.2.dist-info/top_level.txt,sha256=xrg4zRnqDyl_JEyEQh3oCcAU4BHneocD-DCFDzf4g9E,12
|
|
6
|
+
pillow_avif_plugin-1.4.2.dist-info/METADATA,sha256=G7VYS-n_7MVgMI_3pzslXCd-ZW8fI2weKDxlVxKzYmk,1668
|
|
7
|
+
pillow_avif_plugin.libs/libgcc_s-a04fdf82.so.1,sha256=YxqJNaesQMhDswHEQpXsiLnVvMBBbYO6KYMDZFPWKSM,81257
|
|
8
|
+
pillow_avif/AvifImagePlugin.py,sha256=se4JpJUjAnnmMBGse2O_YaggpPrvHRdcTg_TGQsCAg4,8179
|
|
9
|
+
pillow_avif/_avif.cpython-310-x86_64-linux-gnu.so,sha256=iSXdf-1V9WSKRoydhOa7FvB4UaQw_1XCm8an8t2zR04,21722953
|
|
10
|
+
pillow_avif/__init__.py,sha256=f6QUykmiiEKOe3vqwVOGduagE9zCf89g75i_ajHVULE,84
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
pillow_avif/AvifImagePlugin.py,sha256=GeBGlSqlc7BxefTzMKK-YRTJcvo7GeE68jqDdraUnkA,8434
|
|
2
|
-
pillow_avif/_avif.cpython-310-x86_64-linux-gnu.so,sha256=HFtyiwgh4IlbruDpPZnx5YQxAlCHJRj7q6156UcYuiQ,21722953
|
|
3
|
-
pillow_avif/__init__.py,sha256=KOvHpXQefN5SKRheYSTMIbRHWVvp6ClvnfT0cjDmL5M,84
|
|
4
|
-
pillow_avif_plugin.libs/libgcc_s-a04fdf82.so.1,sha256=YxqJNaesQMhDswHEQpXsiLnVvMBBbYO6KYMDZFPWKSM,81257
|
|
5
|
-
pillow_avif_plugin-1.4.0.dist-info/METADATA,sha256=-t1rfG3DAYJqocic2KMehZij-n-6_S1PUozPJvLJ6t4,1668
|
|
6
|
-
pillow_avif_plugin-1.4.0.dist-info/LICENSE,sha256=2l49eVdgaNy9JTEPbstz1GaaPKw02gFdtuThTNUi730,25213
|
|
7
|
-
pillow_avif_plugin-1.4.0.dist-info/WHEEL,sha256=Qybn9f_9c7ImWsQIXNA7u-F9d7QLLBwD346Igm-60cw,113
|
|
8
|
-
pillow_avif_plugin-1.4.0.dist-info/RECORD,,
|
|
9
|
-
pillow_avif_plugin-1.4.0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
10
|
-
pillow_avif_plugin-1.4.0.dist-info/top_level.txt,sha256=xrg4zRnqDyl_JEyEQh3oCcAU4BHneocD-DCFDzf4g9E,12
|
|
File without changes
|
|
File without changes
|
|
File without changes
|