pillow-avif-plugin 1.4.1__cp38-cp38-win_amd64.whl → 1.4.3__cp38-cp38-win_amd64.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.

@@ -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
@@ -146,6 +149,20 @@ def _save(im, fp, filename, save_all=False):
146
149
  exif = info.get("exif", im.info.get("exif"))
147
150
  if isinstance(exif, Image.Exif):
148
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
+
149
166
  xmp = info.get("xmp", im.info.get("xmp") or im.info.get("XML:com.adobe.xmp"))
150
167
 
151
168
  if isinstance(xmp, text_type):
@@ -187,6 +204,7 @@ def _save(im, fp, filename, save_all=False):
187
204
  autotiling,
188
205
  icc_profile or b"",
189
206
  exif or b"",
207
+ exif_orientation,
190
208
  xmp or b"",
191
209
  advanced,
192
210
  )
pillow_avif/__init__.py CHANGED
@@ -2,4 +2,4 @@ from . import AvifImagePlugin
2
2
 
3
3
 
4
4
  __all__ = ["AvifImagePlugin"]
5
- __version__ = "1.4.1"
5
+ __version__ = "1.4.3"
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pillow-avif-plugin
3
- Version: 1.4.1
3
+ Version: 1.4.3
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,9 @@
1
+ pillow_avif/AvifImagePlugin.py,sha256=lAVnA30X0re_zar8Wp0-Z9grIVZMqv60sH0HHbetExg,8454
2
+ pillow_avif/__init__.py,sha256=c68dCdjcj9aZDFR4eX4aVammttGgrX8xhUuNT2qbOCs,89
3
+ pillow_avif/_avif.cp38-win_amd64.pyd,sha256=QLUJX-qCGUxK3vwU87F53MVNMmtWZx1Ja5H0SRBTnb0,28395008
4
+ pillow_avif_plugin-1.4.3.dist-info/LICENSE,sha256=tubzK3TFrT8GFgUPEKC-WmCziD1dGOFLCjDky3t9Lnc,1321
5
+ pillow_avif_plugin-1.4.3.dist-info/METADATA,sha256=V8ODP5OEe4i8KFj_ElSlRCfY0uEYCgayihu1vYKr9IQ,1704
6
+ pillow_avif_plugin-1.4.3.dist-info/WHEEL,sha256=3SeyPJ5-Us2Ct5GSftUVKtLSlm-bNefW4m5qd0GLzww,100
7
+ pillow_avif_plugin-1.4.3.dist-info/top_level.txt,sha256=xrg4zRnqDyl_JEyEQh3oCcAU4BHneocD-DCFDzf4g9E,12
8
+ pillow_avif_plugin-1.4.3.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
9
+ pillow_avif_plugin-1.4.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp38-cp38-win_amd64
5
5
 
@@ -1,9 +0,0 @@
1
- pillow_avif/AvifImagePlugin.py,sha256=ZwCoyw5Hwa2zG6JIbY08nTrTkGHI7b9STqZz_M3Jdu4,7987
2
- pillow_avif/__init__.py,sha256=Hnq8yBGcYTD6CuTNoMRgJgx7l2ozTaskKip-Wpuz0j0,89
3
- pillow_avif/_avif.cp38-win_amd64.pyd,sha256=d2XRdqjaxleUdT9yrsiImTEDL0h7md_7XHT1TNuMMsU,26011648
4
- pillow_avif_plugin-1.4.1.dist-info/LICENSE,sha256=tubzK3TFrT8GFgUPEKC-WmCziD1dGOFLCjDky3t9Lnc,1321
5
- pillow_avif_plugin-1.4.1.dist-info/METADATA,sha256=sJS-yzL8D5RqiTSUjcmez7DmNhIDHf91IqK341gwP-I,1704
6
- pillow_avif_plugin-1.4.1.dist-info/WHEEL,sha256=KplWMgwSZbeAOumvxNxIrVbNPnn_LVzfBH7l38jDCVM,100
7
- pillow_avif_plugin-1.4.1.dist-info/top_level.txt,sha256=xrg4zRnqDyl_JEyEQh3oCcAU4BHneocD-DCFDzf4g9E,12
8
- pillow_avif_plugin-1.4.1.dist-info/zip-safe,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
9
- pillow_avif_plugin-1.4.1.dist-info/RECORD,,