-
Notifications
You must be signed in to change notification settings - Fork 231
BMP import/export #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Let me look what changes are required to read this binary |
I wrote that Python script to convert images to json that can be imported with the mobile app: from PIL import Image
import json
def bmp_to_hex_list(image_path):
image = Image.open(image_path).convert('1')
image_width, image_height = image.size
char_width = 8
char_height = 11
num_chars = image_width // char_width
hex_data = []
for col in range(num_chars):
binary_str = ""
for y in range(char_height):
for x in range(char_width):
bit = 1 if image.getpixel((col * char_width + x, y)) == 0 else 0
binary_str += str(bit)
hex_str = hex(int(binary_str, 2))[2:].zfill((char_width * char_height) // 4)
hex_data.append(hex_str)
return hex_data
badge={'messages':[{'text':bmp_to_hex_list('badge.bmp'),'flash':False,'marquee':False,'speed':'0x60','mode':'0x00','invert':False}]}
print(json.dumps(badge, indent=4)) |
@benjaminbellamy thats wonderful. Would you like to add an import feature that can do the same in the app? Feel free to create a PR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the feature you'd like
It would be great if the badge magic app could export and import bmp images
Additional context
The OEM app has this feature.
The text was updated successfully, but these errors were encountered: