~ubuntu-branches/ubuntu/quantal/python-imaging/quantal-security

« back to all changes in this revision

Viewing changes to PIL/BmpImagePlugin.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-11-20 19:22:59 UTC
  • mfrom: (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091120192259-cmnfui5tv2jtq4xu
Tags: 1.1.7-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# The Python Imaging Library.
3
 
# $Id: BmpImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
 
3
# $Id$
4
4
#
5
5
# BMP file handler
6
6
#
47
47
    1: ("P", "P;1"),
48
48
    4: ("P", "P;4"),
49
49
    8: ("P", "P"),
50
 
    16: ("RGB", "BGR;16"),
 
50
    16: ("RGB", "BGR;15"),
51
51
    24: ("RGB", "BGR"),
52
52
    32: ("RGB", "BGRX")
53
53
}
82
82
            compression = 0
83
83
            lutsize = 3
84
84
            colors = 0
 
85
            direction = -1
85
86
 
86
87
        elif len(s) in [40, 64]:
87
88
 
91
92
            compression = i32(s[16:])
92
93
            lutsize = 4
93
94
            colors = i32(s[32:])
 
95
            direction = -1
 
96
            if s[11] == '\xff':
 
97
                # upside-down storage
 
98
                self.size = self.size[0], 2**32 - self.size[1]
 
99
                direction = 0
94
100
 
95
101
        else:
96
102
            raise IOError("Unsupported BMP header type (%d)" % len(s))
149
155
        self.tile = [("raw",
150
156
                     (0, 0) + self.size,
151
157
                     offset,
152
 
                     (rawmode, ((self.size[0]*bits+31)>>3)&(~3), -1))]
 
158
                     (rawmode, ((self.size[0]*bits+31)>>3)&(~3), direction))]
153
159
 
154
160
        self.info["compression"] = compression
155
161