diff --git a/async-bot.py b/async-bot.py index 4b76a23..9f83429 100644 --- a/async-bot.py +++ b/async-bot.py @@ -116,7 +116,9 @@ async def amain(): with Image.open(elem["path"]).convert("RGB") as im: for y in range(im.height): for x in range(im.width): - r, g, b = im.getpixel((x, y)) # type: ignore + r, g, b, a = im.getpixel((x, y)) # type: ignore + if a < 128: + continue pocket_x = x + ox pocket_y = y + oy @@ -126,10 +128,12 @@ async def amain(): mgr.difference[ndx_start + 2] = b > 128 elif elem["type"] == "rgb565": ox, oy = elem["x"], elem["y"] - with Image.open(elem["path"]).convert("RGB") as im: + with Image.open(elem["path"]).convert("RGBA") as im: for y in range(im.height): for x in range(im.width): - r, g, b = im.getpixel((x, y)) # type: ignore + r, g, b, a = im.getpixel((x, y)) # type: ignore + if a < 128: + continue ndx_start: int = (x + ox + (y + oy) * 250) * 16 color = (r >> 3) << 13 color |= (g >> 2) << 5