Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d656646

Browse files
author
m32
committed
missing dependencies, some images are nonconvertable - ignore them
1 parent b67f383 commit d656646

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

litehtml-pango-png.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import io
66
import logging
7+
import requests
78
import urllib.parse
89
from PIL import Image
910
import logme
@@ -52,8 +53,12 @@ def HtmlLoadImage(self, cntr, src, baseurl, redraw_on_ready):
5253
print('bang')
5354
return
5455
if 'A' not in im.getbands():
56+
alpha = 1.0
5557
im.putalpha(int(alpha * 256.))
56-
arr = bytearray(im.tobytes('raw', 'BGRa'))
58+
try:
59+
arr = bytearray(im.tobytes('raw', 'BGRa'))
60+
except ValueError:
61+
return
5762
cntr.put_image(url, arr, im.width, im.height)
5863

5964

0 commit comments

Comments
 (0)