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 1
1
from io import BytesIO
2
- from typing import cast , Union
2
+ from typing import cast , Union , Optional
3
3
4
4
from PIL import Image
5
5
from diffimg import diff
11
11
OrientationType ,
12
12
ColorModeType ,
13
13
ImageType ,
14
+ ColorType ,
14
15
)
15
16
16
17
@@ -51,12 +52,12 @@ def resize_canvas(im: ImageType, new_size: ImageSize) -> BytesIO:
51
52
def convert_color_mode (
52
53
im : ImageType ,
53
54
color_mode : ColorModeType ,
54
- alpha_color : tuple [ int , int , int ] = ALPHA_COLOR ,
55
+ alpha_color : Optional [ ColorType ] = ALPHA_COLOR ,
55
56
) -> Union [ImageType , None ]:
56
57
if im .mode == color_mode :
57
58
return None
58
59
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 )
60
61
61
62
alpha_image = Image .alpha_composite (im , background ).convert (color_mode )
62
63
You can’t perform that action at this time.
0 commit comments