From 1224b027506c112b47983bd0c66f0ab06c0a80a9 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 15 Feb 2022 20:40:35 +1100 Subject: [PATCH] Print size of frames Update img2logo.py --- Bootup Logos/img2logo.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Bootup Logos/img2logo.py b/Bootup Logos/img2logo.py index ba30177..19a1d8a 100755 --- a/Bootup Logos/img2logo.py +++ b/Bootup Logos/img2logo.py @@ -149,7 +149,9 @@ def animated_image_to_bytes(imageIn: Image, negative: bool, dither: bool, thresh # First we always start with a full first frame; future optimisation to check if we should or not outputData = [DATA_PROGRAMMED_MARKER] outputData.append(frameTiming) - outputData.extend(get_screen_blob([0x00] * (LCD_NUM_BYTES), frameData[0])) + first_frame = get_screen_blob([0x00] * (LCD_NUM_BYTES), frameData[0]) + outputData.extend(first_frame) + print(f"Frame 0 encoded to {len(first_frame)} bytes") """ Format for each frame block is: @@ -162,10 +164,11 @@ def animated_image_to_bytes(imageIn: Image, negative: bool, dither: bool, thresh for id in range(1, len(frameData)): frameBlob = get_screen_blob(frameData[id - 1], frameData[id]) if (len(outputData) + len(frameBlob)) > LCD_PAGE_SIZE: - print(f"Truncating animation after {id} frames as we are out of space") + print(f"Truncating animation after {id-1} frames as we are out of space") break print(f"Frame {id} encoded to {len(frameBlob)} bytes") outputData.extend(frameBlob) + print(f"Total size used: {len(outputData)} of 1024 bytes") return outputData