fixed script

This commit is contained in:
Bernd Herzog 2023-03-21 21:31:59 +01:00
parent 7b3ab64930
commit 8fcedb017c

View File

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