Do not cast to bytes for set_as_raw()

This commit is contained in:
Andrew Murray 2024-04-01 15:24:40 +11:00
parent f69168523e
commit badc92079d
3 changed files with 4 additions and 4 deletions

View File

@ -341,7 +341,7 @@ class BLP1Decoder(_BLPBaseDecoder):
if self._blp_encoding in (4, 5): if self._blp_encoding in (4, 5):
palette = self._read_palette() palette = self._read_palette()
data = self._read_bgra(palette) data = self._read_bgra(palette)
self.set_as_raw(bytes(data)) self.set_as_raw(data)
else: else:
msg = f"Unsupported BLP encoding {repr(self._blp_encoding)}" msg = f"Unsupported BLP encoding {repr(self._blp_encoding)}"
raise BLPFormatError(msg) raise BLPFormatError(msg)
@ -412,7 +412,7 @@ class BLP2Decoder(_BLPBaseDecoder):
msg = f"Unknown BLP compression {repr(self._blp_compression)}" msg = f"Unknown BLP compression {repr(self._blp_compression)}"
raise BLPFormatError(msg) raise BLPFormatError(msg)
self.set_as_raw(bytes(data)) self.set_as_raw(data)
class BLPEncoder(ImageFile.PyEncoder): class BLPEncoder(ImageFile.PyEncoder):

View File

@ -506,7 +506,7 @@ class DdsRgbDecoder(ImageFile.PyDecoder):
data += o8( data += o8(
int(((masked_value >> mask_offsets[i]) / mask_totals[i]) * 255) int(((masked_value >> mask_offsets[i]) / mask_totals[i]) * 255)
) )
self.set_as_raw(bytes(data)) self.set_as_raw(data)
return -1, 0 return -1, 0

View File

@ -98,7 +98,7 @@ class QoiDecoder(ImageFile.PyDecoder):
if bands == 3: if bands == 3:
value = value[:3] value = value[:3]
data += value data += value
self.set_as_raw(bytes(data)) self.set_as_raw(data)
return -1, 0 return -1, 0