Skip to content

Commit

Permalink
use the mode from the reconstructed jpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
Piezoid committed Oct 10, 2024
1 parent 36f7617 commit f5af2ce
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pillow_jxl/JpegXLImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ def _open(self):
if self.jpeg:
with Image.open(BytesIO(self._data)) as im:
self._data = im.tobytes()
self._size = (self._jxlinfo.width, self._jxlinfo.height)
self.rawmode = self._jxlinfo.mode
self.info["icc_profile"] = icc_profile
self._size = im.size
self.rawmode = im.mode
self.info = im.info
icc_profile = im.info.get("icc_profile", icc_profile)
else:
self._size = (self._jxlinfo.width, self._jxlinfo.height)
self.rawmode = self._jxlinfo.mode
if icc_profile:
self.info["icc_profile"] = icc_profile
# NOTE (Isotr0py): PIL 10.1.0 changed the mode to property, use _mode instead
if parse(PIL.__version__) >= parse("10.1.0"):
self._mode = self.rawmode
Expand Down

0 comments on commit f5af2ce

Please sign in to comment.