mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Fix for failing ImageQt with mode 'L' image
This commit is contained in:
parent
29fb4523d5
commit
dbecc1cb70
|
@ -20,17 +20,17 @@ from PIL import Image
|
|||
from PIL._util import isPath
|
||||
|
||||
try:
|
||||
from PyQt5.QtGui import QImage, qRgb
|
||||
from PyQt5.QtGui import QImage, qRgba
|
||||
except:
|
||||
from PyQt4.QtGui import QImage, qRgb
|
||||
from PyQt4.QtGui import QImage, qRgba
|
||||
|
||||
##
|
||||
# (Internal) Turns an RGB color into a Qt compatible color integer.
|
||||
|
||||
def rgb(r, g, b):
|
||||
def rgb(r, g, b, a=255):
|
||||
# use qRgb to pack the colors, and then turn the resulting long
|
||||
# into a negative integer with the same bitpattern.
|
||||
return (qRgb(r, g, b) & 0xffffff) - 0x1000000
|
||||
return (qRgba(r, g, b, a) & 0xffffffff)
|
||||
|
||||
##
|
||||
# An PIL image wrapper for Qt. This is a subclass of PyQt4's QImage
|
||||
|
|
Loading…
Reference in New Issue
Block a user