~ubuntu-branches/ubuntu/saucy/python-imaging/saucy-proposed

« back to all changes in this revision

Viewing changes to PIL/ImageQt.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# See the README file for information on usage and redistribution.
16
16
#
17
17
 
18
 
import Image
 
18
from . import Image
19
19
 
20
20
from PyQt4.QtGui import QImage, qRgb
21
21
 
62
62
            for i in range(0, len(palette), 3):
63
63
                colortable.append(rgb(*palette[i:i+3]))
64
64
        elif im.mode == "RGB":
65
 
            data = im.tostring("raw", "BGRX")
 
65
            data = im.tobytes("raw", "BGRX")
66
66
            format = QImage.Format_RGB32
67
67
        elif im.mode == "RGBA":
68
68
            try:
69
 
                data = im.tostring("raw", "BGRA")
 
69
                data = im.tobytes("raw", "BGRA")
70
70
            except SystemError:
71
71
                # workaround for earlier versions
72
72
                r, g, b, a = im.split()
76
76
            raise ValueError("unsupported image mode %r" % im.mode)
77
77
 
78
78
        # must keep a reference, or Qt will crash!
79
 
        self.__data = data or im.tostring()
 
79
        self.__data = data or im.tobytes()
80
80
 
81
81
        QImage.__init__(self, self.__data, im.size[0], im.size[1], format)
82
82