2
# The Python Imaging Library.
5
# PIXAR raster support for PIL
11
# This is incomplete; it is based on a few samples created with
12
# Photoshop 2.5 and 3.0, and a summary description provided by
13
# Greg Coats <gcoats@labiris.er.usgs.gov>. Hopefully, "L" and
14
# "RGBA" support will be added in future versions.
16
# Copyright (c) Secret Labs AB 1997.
17
# Copyright (c) Fredrik Lundh 1997.
19
# See the README file for information on usage and redistribution.
24
import Image, ImageFile
30
return ord(c[0]) + (ord(c[1])<<8)
33
return ord(c[0]) + (ord(c[1])<<8) + (ord(c[2])<<16) + (ord(c[3])<<24)
36
# Image plugin for PIXAR raster images.
38
class PixarImageFile(ImageFile.ImageFile):
41
format_description = "PIXAR raster image"
45
# assuming a 4-byte magic label (FIXME: add "_accept" hook)
47
if s != "\200\350\000\000":
48
raise SyntaxError, "not a PIXAR file"
51
s = s + self.fp.read(508)
53
self.size = i16(s[418:420]), i16(s[416:418])
55
# get channel/depth descriptions
56
mode = i16(s[424:426]), i16(s[426:428])
60
# FIXME: to be continued...
62
# create tile descriptor (assuming "dumped")
63
self.tile = [("raw", (0,0)+self.size, 1024, (self.mode, 0, 1))]
66
# --------------------------------------------------------------------
68
Image.register_open("PIXAR", PixarImageFile)
71
# FIXME: what's the standard extension?