home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
pypil112.zip
/
PIL-1.1.2.zip
/
Lib
/
site-packages
/
PIL
/
XVThumbImagePlugin.pyc
(
.txt
)
< prev
Wrap
Python Compiled Bytecode
|
2001-12-25
|
2KB
|
41 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.2)
__version__ = '0.1'
import string
import Image
import ImageFile
import ImagePalette
PALETTE = ''
for r in range(8):
for g in range(8):
for b in range(4):
PALETTE = PALETTE + chr(r * 255 / 7) + chr(g * 255 / 7) + chr(b * 255 / 3)
class XVThumbImageFile(ImageFile.ImageFile):
format = 'XVThumb'
format_description = 'XV thumbnail image'
def _open(self):
s = self.fp.read(6)
if s != 'P7 332':
raise SyntaxError, 'not an XV thumbnail file'
while 1:
s = string.strip(self.fp.readline())
if s == '#END_OF_COMMENTS':
break
s = string.split(self.fp.readline())
self.mode = 'P'
self.size = (int(s[0]), int(s[1]))
self.palette = ImagePalette.raw('RGB', PALETTE)
self.tile = [
('raw', (0, 0) + self.size, self.fp.tell(), (self.mode, 0, 1))]
Image.register_open('XVThumb', XVThumbImageFile)