diff options
author | cybernesto <[email protected]> | 2022-01-12 17:45:22 +0100 |
---|---|---|
committer | cybernesto <[email protected]> | 2022-01-12 17:45:22 +0100 |
commit | 1564f881f466bbb9944e5fac843c3d718b75ca65 (patch) | |
tree | 15fd88733a17b1d884bcdce7d2102ac6800921a1 /Bootup Logo | |
parent | e8fc7cc7f83f8c5861dec8571b65b51e53d910a5 (diff) | |
download | IronOS-1564f881f466bbb9944e5fac843c3d718b75ca65.tar.gz IronOS-1564f881f466bbb9944e5fac843c3d718b75ca65.zip |
Add capability of writing logos in binary format
Extended python script to support writing .bin files directly. This avoids the additional step of using objcopy.
Updated the 001_PINECIL.bin file to match the PNG.
Diffstat (limited to 'Bootup Logo')
-rw-r--r-- | Bootup Logo/Logos/001_PINECIL.bin | bin | 1024 -> 1024 bytes | |||
-rw-r--r-- | Bootup Logo/python_logo_converter/img2ts100.py | 35 |
2 files changed, 25 insertions, 10 deletions
diff --git a/Bootup Logo/Logos/001_PINECIL.bin b/Bootup Logo/Logos/001_PINECIL.bin Binary files differindex df0a6d92..5d3834a6 100644 --- a/Bootup Logo/Logos/001_PINECIL.bin +++ b/Bootup Logo/Logos/001_PINECIL.bin diff --git a/Bootup Logo/python_logo_converter/img2ts100.py b/Bootup Logo/python_logo_converter/img2ts100.py index 8691a7e2..3759c153 100644 --- a/Bootup Logo/python_logo_converter/img2ts100.py +++ b/Bootup Logo/python_logo_converter/img2ts100.py @@ -13,7 +13,7 @@ except ImportError as error: "management tool." .format(error, sys.argv[0])) -VERSION_STRING = '0.01' +VERSION_STRING = '0.02' LCD_WIDTH = 96 LCD_HEIGHT = 16 @@ -87,7 +87,8 @@ def img2hex(input_filename, preview_filename=None, threshold=128, dither=False, - negative=False): + negative=False, + binary=False): """ Convert 'input_filename' image file into Intel hex format with data formatted for display on TS100 LCD and file object. @@ -158,7 +159,11 @@ def img2hex(input_filename, # store in endian-reversed byte order data[4 + ndx + (1 if ndx % 2 == 0 else -1)] = byte - intel_hex(output_file, data, 0x0800F800) + if binary: + for byte in data: + output_file.write(byte.to_bytes(1, byteorder="big")) + else: + intel_hex(output_file, data, 0x0800F800) def parse_commandline(): @@ -229,13 +234,23 @@ if __name__ == "__main__": sys.exit(1) try: - with open(args.output_filename, 'w', newline='\r\n') as output: - img2hex(args.input_filename, - output, - args.preview, - args.threshold, - args.dither, - args.negative) + if args.output_filename[-4:] == ".bin": + with open(args.output_filename, 'wb') as output: + img2hex(args.input_filename, + output, + args.preview, + args.threshold, + args.dither, + args.negative, + True) + else: + with open(args.output_filename, 'w', newline='\r\n') as output: + img2hex(args.input_filename, + output, + args.preview, + args.threshold, + args.dither, + args.negative) except BaseException as error: sys.stderr.write("Error converting file: {}\n".format(error)) sys.exit(1) |