From 325503320e0a3d8d6341279de1f539abd0a1264e Mon Sep 17 00:00:00 2001 From: Mickael Bonfill Date: Fri, 28 Jul 2017 17:30:55 -0400 Subject: [PATCH] add support of python 3's bytearray --- PIL/SgiImagePlugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PIL/SgiImagePlugin.py b/PIL/SgiImagePlugin.py index 2cc3404eb..cbd98d26e 100644 --- a/PIL/SgiImagePlugin.py +++ b/PIL/SgiImagePlugin.py @@ -26,6 +26,7 @@ from . import Image, ImageFile from ._binary import i8, o8, i16be as i16, o16be as o16 import struct import os +import sys __version__ = "0.3" @@ -217,7 +218,10 @@ class SGI16Decoder(ImageFile.PyDecoder): y * stride + z * pagesize) * 2 pixel = i16(s, o=bi) pixel = int(pixel // 256) - data[i] = o8(pixel) + if sys.version_info.major == 3: + data[i] = pixel + else: + data[i] = o8(pixel) i += 1 y += orientation self.set_as_raw(bytes(data))