Skip to content

Commit

Permalink
Moved RGB fix inside ImageQt class
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 16, 2021
1 parent fdd8b68 commit 56ed217
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/PIL/ImageQt.py
Expand Up @@ -152,7 +152,10 @@ def _toqclass_helper(im):
for i in range(0, len(palette), 3):
colortable.append(rgb(*palette[i : i + 3]))
elif im.mode == "RGB":
data = im.tobytes("raw", "BGRX")
# Populate the 4th channel with 255
im = im.convert("RGBA")

data = im.tobytes("raw", "BGRA")
format = qt_format.Format_RGB32
elif im.mode == "RGBA":
data = im.tobytes("raw", "BGRA")
Expand Down Expand Up @@ -200,9 +203,6 @@ def toqpixmap(im):
# im_data = _toqclass_helper(im)
# result = QPixmap(im_data['im'].size[0], im_data['im'].size[1])
# result.loadFromData(im_data['data'])
# Fix some strange bug that causes
if im.mode == "RGB":
im = im.convert("RGBA")

qimage = toqimage(im)
return QPixmap.fromImage(qimage)

0 comments on commit 56ed217

Please sign in to comment.