导入图片排班表:改进黑白主题检测
All checks were successful
ci/woodpecker/push/check_format Pipeline was successful

This commit is contained in:
zhbaor 2024-10-27 17:05:44 +08:00
parent 21eda652f5
commit dc02c9bcf9

View file

@ -58,7 +58,7 @@ def export(plan: Dict, img: Image.Image, theme: str = "light") -> Image.Image:
def decode(img: Image.Image) -> Optional[Dict]:
img = img.convert("RGB")
if img.getpixel((0, 0)) == BLACK:
if img.getpixel((0, 0))[0] < 127:
img = ImageChops.invert(img)
result = []
while len(data := pyzbar.decode(img)):