This commit is contained in:
hugovk 2014-07-16 21:30:41 +03:00
parent 2b3d655833
commit 3322bfbad0

View File

@ -31,6 +31,7 @@ i32 = _binary.i32be
def _accept(prefix):
return i16(prefix) == 474
##
# Image plugin for SGI images.
@ -65,17 +66,18 @@ class SgiImageFile(ImageFile.ImageFile):
# size
self.size = i16(s[6:]), i16(s[8:])
# decoder info
if compression == 0:
offset = 512
pagesize = self.size[0]*self.size[1]*layout[0]
self.tile = []
for layer in self.mode:
self.tile.append(("raw", (0,0)+self.size, offset, (layer,0,-1)))
self.tile.append(
("raw", (0, 0)+self.size, offset, (layer, 0, -1)))
offset = offset + pagesize
elif compression == 1:
self.tile = [("sgi_rle", (0,0)+self.size, 512, (self.mode, 0, -1))]
self.tile = [
("sgi_rle", (0, 0)+self.size, 512, (self.mode, 0, -1))]
#
# registry
@ -86,4 +88,4 @@ Image.register_extension("SGI", ".bw")
Image.register_extension("SGI", ".rgb")
Image.register_extension("SGI", ".rgba")
Image.register_extension("SGI", ".sgi") # really?
Image.register_extension("SGI", ".sgi")