2
# Python Imaging Library
5
# stuff to read simple, teragon-style palette files
10
# Copyright (c) Secret Labs AB 1997.
11
# Copyright (c) Fredrik Lundh 1997.
13
# See the README file for information on usage and redistribution.
19
# File handler for Teragon-style palette files.
25
def __init__(self, fp):
27
self.palette = map(lambda i: (i, i, i), range(256))
38
raise SyntaxError, "bad palette file"
40
v = map(int, string.split(s))
48
self.palette[i] = chr(r) + chr(g) + chr(b)
50
self.palette = string.join(self.palette, "")
55
return self.palette, self.rawmode