Prevent indexing error for mode RGB

I have not explicitly tested mode P
This commit is contained in:
spezialspezial 2022-10-29 23:21:53 +02:00 committed by Lincoln Stein
parent e4a212dfca
commit c2fab45a6e

View File

@ -965,6 +965,8 @@ class Generate:
# Obtain the mask from the transparency channel
if mask_image.mode == 'L':
mask = mask_image
elif mask_image.mode in ('RGB', 'P'):
mask = mask_image.convert('L')
else:
# Obtain the mask from the transparency channel
mask = Image.new(mode="L", size=mask_image.size, color=255)