fixed packing

This commit is contained in:
Bernd Herzog 2023-03-21 22:01:09 +01:00
parent 8fcedb017c
commit 7b4662fe4a

View File

@ -56,15 +56,17 @@ if len(sys.argv) == 4:
for i in range(4 - (len(input_image) & 3)): for i in range(4 - (len(input_image) & 3)):
input_image.append(0) input_image.append(0)
input_image += struct.pack('<4BI', tag[0], tag[1], tag[2], tag[3], len(input_image) - 4) output_image = bytearray()
write_image(input_image, output_path) output_image += struct.pack('<4BI', tag[0], tag[1], tag[2], tag[3], len(input_image) - 4)
output_image += input_image
write_image(output_image, output_path)
elif len(sys.argv) == 2: elif len(sys.argv) == 2:
input_image = bytearray() null_image = bytearray()
tag = (0, 0, 0, 0) tag = (0, 0, 0, 0)
output_path = sys.argv[1] output_path = sys.argv[1]
input_image += struct.pack('<4BI', tag[0], tag[1], tag[2], tag[3], 0) null_image += struct.pack('<4BI', tag[0], tag[1], tag[2], tag[3], 0)
write_image(input_image, output_path) write_image(null_image, output_path)
else: else:
print(usage_message) print(usage_message)