mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Re-added ImageQt class
This commit is contained in:
parent
854d343aa5
commit
b318595666
|
@ -125,14 +125,7 @@ def _toqclass_helper(im):
|
||||||
|
|
||||||
|
|
||||||
def toqimage(im):
|
def toqimage(im):
|
||||||
im_data = _toqclass_helper(im)
|
return ImageQt(im)
|
||||||
result = QImage(
|
|
||||||
im_data['data'], im_data['im'].size[0], im_data['im'].size[1],
|
|
||||||
im_data['format']
|
|
||||||
)
|
|
||||||
if im_data['colortable']:
|
|
||||||
result.setColorTable(im_data['colortable'])
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def toqpixmap(im):
|
def toqpixmap(im):
|
||||||
|
@ -146,3 +139,21 @@ def toqpixmap(im):
|
||||||
qimage = im.toqimage()
|
qimage = im.toqimage()
|
||||||
qimage.save('/tmp/hopper_{}_qpixmap_qimage.png'.format(im.mode))
|
qimage.save('/tmp/hopper_{}_qpixmap_qimage.png'.format(im.mode))
|
||||||
return QPixmap.fromImage(qimage)
|
return QPixmap.fromImage(qimage)
|
||||||
|
|
||||||
|
##
|
||||||
|
# An PIL image wrapper for Qt. This is a subclass of PyQt4's QImage
|
||||||
|
# class.
|
||||||
|
#
|
||||||
|
# @param im A PIL Image object, or a file name (given either as Python
|
||||||
|
# string or a PyQt string object).
|
||||||
|
|
||||||
|
class ImageQt(QImage):
|
||||||
|
|
||||||
|
def __init__(self, im):
|
||||||
|
im_data = _toqclass_helper(im)
|
||||||
|
QImage.__init__(self,
|
||||||
|
im_data['data'], im_data['im'].size[0], im_data['im'].size[1],
|
||||||
|
im_data['format']
|
||||||
|
)
|
||||||
|
if im_data['colortable']:
|
||||||
|
self.setColorTable(im_data['colortable'])
|
Loading…
Reference in New Issue
Block a user