File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 11from io import BytesIO
2- from typing import cast , Union
2+ from typing import cast , Union , Optional
33
44from PIL import Image
55from diffimg import diff
1111 OrientationType ,
1212 ColorModeType ,
1313 ImageType ,
14+ ColorType ,
1415)
1516
1617
@@ -51,12 +52,12 @@ def resize_canvas(im: ImageType, new_size: ImageSize) -> BytesIO:
5152def convert_color_mode (
5253 im : ImageType ,
5354 color_mode : ColorModeType ,
54- alpha_color : tuple [ int , int , int ] = ALPHA_COLOR ,
55+ alpha_color : Optional [ ColorType ] = ALPHA_COLOR ,
5556) -> Union [ImageType , None ]:
5657 if im .mode == color_mode :
5758 return None
5859 im = im .convert ("RGBA" )
59- background = Image .new ("RGBA" , im .size , alpha_color )
60+ background = Image .new ("RGBA" , im .size , alpha_color or ALPHA_COLOR )
6061
6162 alpha_image = Image .alpha_composite (im , background ).convert (color_mode )
6263
You can’t perform that action at this time.
0 commit comments