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
/
McIdasImagePlugin.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2001-12-25
|
2KB
|
44 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.2)
__version__ = '0.1'
import string
import Image
import ImageFile
def i16(c, i = 0):
return ord(c[1 + i]) + (ord(c[i]) << 8)
def i32(c, i = 0):
return ord(c[3 + i]) + (ord(c[2 + i]) << 8) + (ord(c[1 + i]) << 16) + (ord(c[i]) << 24)
def _accept(s):
if i32(s) == 0:
pass
return i32(s, 4) == 4
class McIdasImageFile(ImageFile.ImageFile):
format = 'MCIDAS'
format_description = 'McIdas area file'
def _open(self):
s = self.fp.read(256)
if not _accept(s):
raise SyntaxError, 'not an McIdas area file'
if i32(s, 40) != 1 or i32(s, 52) != 1:
raise SyntaxError, 'unsupported McIdas format'
self.mode = 'L'
self.size = (i32(s, 36), i32(s, 32))
prefix = i32(s, 56)
offset = i32(s, 132)
self.tile = [
('raw', (0, 0) + self.size, offset, ('L', prefix + self.size[0], 1))]
Image.register_open('MCIDAS', McIdasImageFile, _accept)