diff --git a/main.py b/main.py index 00e42cd..5cdb41a 100644 --- a/main.py +++ b/main.py @@ -31,6 +31,11 @@ def print_picture(filename, p): img = Image.open(io.BytesIO(response.content)) + if img.mode == 'RGBA': + bg = Image.new('RGB', img.size, (255, 255, 255)) + bg.paste(img, mask=img.split()[3]) + img = bg + # Convert with dithering img = img.convert('1', dither=Image.FLOYDSTEINBERG)