add support of python 3's bytearray

This commit is contained in:
Mickael Bonfill 2017-07-28 17:30:55 -04:00 committed by Eric Soroos
parent a422a28bb7
commit 1ba6ff8a33

View File

@ -26,6 +26,7 @@ from . import Image, ImageFile
from ._binary import i8, o8, i16be as i16, o16be as o16 from ._binary import i8, o8, i16be as i16, o16be as o16
import struct import struct
import os import os
import sys
__version__ = "0.3" __version__ = "0.3"
@ -217,6 +218,9 @@ class SGI16Decoder(ImageFile.PyDecoder):
y * stride + z * pagesize) * 2 y * stride + z * pagesize) * 2
pixel = i16(s, o=bi) pixel = i16(s, o=bi)
pixel = int(pixel // 256) pixel = int(pixel // 256)
if sys.version_info.major == 3:
data[i] = pixel
else:
data[i] = o8(pixel) data[i] = o8(pixel)
i += 1 i += 1
y += orientation y += orientation