diff --git a/custom_components/rwth_gym_util/manifest.json b/custom_components/rwth_gym_util/manifest.json index 60ab2a8..faa1224 100644 --- a/custom_components/rwth_gym_util/manifest.json +++ b/custom_components/rwth_gym_util/manifest.json @@ -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": [] } \ No newline at end of file diff --git a/custom_components/rwth_gym_util/rwth_gym.py b/custom_components/rwth_gym_util/rwth_gym.py index 61c7c1b..26a7961 100644 --- a/custom_components/rwth_gym_util/rwth_gym.py +++ b/custom_components/rwth_gym_util/rwth_gym.py @@ -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 @@ -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