Skip to content

Commit

Permalink
Use rawmode instead of splitting and merging
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jan 4, 2025
1 parent bd56a95 commit f4104d4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/PIL/BlpImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,8 @@ def _decode_jpeg_stream(self) -> None:
args = image.tile[0].args
assert isinstance(args, tuple)
image.tile = [image.tile[0]._replace(args=(args[0], "CMYK"))]
r, g, b = image.convert("RGB").split()
reversed_image = Image.merge("RGB", (b, g, r))
self.set_as_raw(reversed_image.tobytes())
rawmode = "BGRA" if self.mode == "RGBA" else "BGR"
self.set_as_raw(image.convert("RGB").tobytes(), rawmode)


class BLP2Decoder(_BLPBaseDecoder):
Expand Down

0 comments on commit f4104d4

Please sign in to comment.