Skip to content

Commit

Permalink
support pillow>10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Isotr0py committed Jan 28, 2024
1 parent 0207920 commit d0c0c8f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pillow_jxl/JpegXLImagePlugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from io import BytesIO

import PIL
from PIL import Image, ImageFile
from pkg_resources import parse_version

from pillow_jxl import Decoder, Encoder

_VALID_JXL_MODES = {"RGB", "RGBA", "L", "LA"}
Expand All @@ -24,10 +28,14 @@ def _open(self):
self._decoder = Decoder()

self._jxlinfo, self._data = self._decoder(self.fc)
# self._size = (self._jxlinfo['width'], self._jxlinfo['height'])
# self.mode = self.rawmode = self._jxlinfo["mode"]
self._size = (self._jxlinfo.width, self._jxlinfo.height)
self.mode = self.rawmode = self._jxlinfo.mode
self.rawmode = self._jxlinfo.mode
# NOTE (Isotr0py): PIL 10.1.0 changed the mode to property, use _mode instead
if parse_version(PIL.__version__) >= parse_version("10.1.0"):
self._mode = self.rawmode
else:
self.mode = self.rawmode

self.tile = []

def seek(self, frame):
Expand Down

0 comments on commit d0c0c8f

Please sign in to comment.