Skip to content

Commit

Permalink
Fix bug when occupancy is above 99
Browse files Browse the repository at this point in the history
  • Loading branch information
dorian-K committed Jul 27, 2023
1 parent c1dbd75 commit 4b6dc8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/rwth_gym_util/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"issue_tracker": "https://github.com/dorian-K/rwth-gym-homeassistant/issues",
"requirements": ["pillow"],
"ssdp": [],
"version": "1.0.5",
"version": "1.0.6",
"zeroconf": []
}
8 changes: 4 additions & 4 deletions custom_components/rwth_gym_util/rwth_gym.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ async def get_uptodate_pic():

def split_img(img):
parts = []
for i in range(0, img.width, 22):
for i in range(0, round(img.width / 22) * 22, 22):
# print(i)
parts.append(
img.crop((i, 0, i + 22, img.height))
.resize((22 * 4, 30 * 4), resample=Image.NEAREST)
img.crop((i, 0, min(i + 22, img.width), img.height))
.resize((22, 30), resample=Image.NEAREST)
.convert(mode="L")
)
return parts
Expand All @@ -69,7 +69,7 @@ def make_synthetic_digit(character):
d = ImageDraw.Draw(img)
font = ImageFont.truetype(os.path.dirname(__file__) + "/OpenSans-Regular.ttf", 38)
d.text((0, -12), character, fill=0, font=font)
img = img.resize((22 * 4, 30 * 4), resample=Image.NEAREST)
#img = img.resize((22 * 4, 30 * 4), resample=Image.NEAREST)
return img


Expand Down

0 comments on commit 4b6dc8f

Please sign in to comment.