This commit is contained in:
VerstreuteSeele
2023-01-12 03:23:19 +01:00
13 changed files with 327 additions and 66 deletions
+4 -1
View File
@@ -60,7 +60,10 @@ class ImageTools:
with Image.open(file) as im:
with io.BytesIO() as output:
bw = im.convert("1")
bw = ImageOps.invert(bw)
try:
bw = ImageOps.invert(bw)
except OSError:
bw = bw.point(lambda x: 255 - x)
bw.save(output, format="XBM")
return output.getvalue()