Support 16-bit grayscale ImageQt conversion.

This commit is contained in:
Christopher Bruns 2021-11-28 19:34:14 -08:00 committed by Andrew Murray
parent c43f55121c
commit 6aca23cfa3

View File

@ -108,7 +108,7 @@ def align8to32(bytes, width, mode):
converts each scanline of data from 8 bit to 32 bit aligned
"""
bits_per_pixel = {"1": 1, "L": 8, "P": 8}[mode]
bits_per_pixel = {"1": 1, "L": 8, "P": 8, "I;16": 16}[mode]
# calculate bytes per line and the extra padding if needed
bits_per_line = bits_per_pixel * width
@ -167,6 +167,8 @@ def _toqclass_helper(im):
elif im.mode == "RGBA":
data = im.tobytes("raw", "BGRA")
format = qt_format.Format_ARGB32
elif im.mode == "I;16":
format = qt_format.Format_Grayscale16
else:
if exclusive_fp:
im.close()