Merge pull request #1560 from radarhere/qt

Changed ImageQt import of Image
This commit is contained in:
wiredfool 2015-12-07 13:29:40 +00:00
commit 1f1755a9ec

View File

@ -16,7 +16,7 @@
# See the README file for information on usage and redistribution. # See the README file for information on usage and redistribution.
# #
import PIL from PIL import Image
from PIL._util import isPath from PIL._util import isPath
from io import BytesIO from io import BytesIO
@ -69,7 +69,7 @@ def fromqimage(im):
buffer.close() buffer.close()
b.seek(0) b.seek(0)
return PIL.Image.open(b) return Image.open(b)
def fromqpixmap(im): def fromqpixmap(im):
@ -83,7 +83,7 @@ def fromqpixmap(im):
# bytes_io.write(buffer.data()) # bytes_io.write(buffer.data())
# buffer.close() # buffer.close()
# bytes_io.seek(0) # bytes_io.seek(0)
# return PIL.Image.open(bytes_io) # return Image.open(bytes_io)
def align8to32(bytes, width, mode): def align8to32(bytes, width, mode):
""" """
@ -125,7 +125,7 @@ def _toqclass_helper(im):
else: else:
im = str(im.toUtf8(), "utf-8") im = str(im.toUtf8(), "utf-8")
if isPath(im): if isPath(im):
im = PIL.Image.open(im) im = Image.open(im)
if im.mode == "1": if im.mode == "1":
format = QImage.Format_Mono format = QImage.Format_Mono
@ -149,7 +149,7 @@ def _toqclass_helper(im):
except SystemError: except SystemError:
# workaround for earlier versions # workaround for earlier versions
r, g, b, a = im.split() r, g, b, a = im.split()
im = PIL.Image.merge("RGBA", (b, g, r, a)) im = Image.merge("RGBA", (b, g, r, a))
format = QImage.Format_ARGB32 format = QImage.Format_ARGB32
else: else:
raise ValueError("unsupported image mode %r" % im.mode) raise ValueError("unsupported image mode %r" % im.mode)