delegate float luts to makeARGB()

This commit is contained in:
KIU Shueng Chuan 2021-09-07 00:04:42 +08:00
parent 98d7bcf560
commit 6763b14fb9
1 changed files with 9 additions and 1 deletions

View File

@ -535,7 +535,15 @@ class ImageItem(GraphicsObject):
levels = self.levels
augmented_alpha = False
if image.dtype.kind == 'f':
if lut is not None and lut.dtype != self._xp.uint8:
# Both _try_rescale_float() and _try_combine_lut() assume that
# lut is of type uint8. It is considered a usage error if that
# is not the case.
# However, the makeARGB() codepath has previously allowed such
# a usage to work. Rather than fail outright, we delegate this
# case to makeARGB().
pass
elif image.dtype.kind == 'f':
image, levels, lut, augmented_alpha = self._try_rescale_float(image, levels, lut)
# if we succeeded, we will have an uint8 image with levels None.
# lut if not None will have <= 256 entries