From 4b9ff9e035255daa0e63d6bf5831fc46128e1244 Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Sun, 3 Mar 2024 17:06:37 +0100 Subject: [PATCH] Fix char data encoding --- canvas.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/canvas.py b/canvas.py index 9ade050..ab95cfd 100644 --- a/canvas.py +++ b/canvas.py @@ -85,13 +85,14 @@ class EditorCanvas(tkinter.Canvas): bit_counter=0 current_value=0 for pixel in self.current_char_pixels: - current_value|=pixel if bit_counter==8: packed_data.append(current_value) bit_counter=0 current_value=0 - current_value<<=1 + current_value|=(pixel<<(7-bit_counter)) bit_counter+=1 + if bit_counter>1: + packed_data.append(current_value) self.project.chars[chr(self.current_char)]=base64.b64encode(bytes(packed_data)).decode("ascii")