Tweak make_image_chunk to produce empty chunk when argc == 2.

This commit is contained in:
Jared Boone 2016-06-30 19:36:23 -07:00
parent 184eb9eb0d
commit 61f954dbeb

View File

@ -41,14 +41,18 @@ def write_image(data, path):
f.write(data) f.write(data)
f.close() f.close()
if len(sys.argv) != 4: if len(sys.argv) == 4:
input_image = read_image(sys.argv[1])
tag = sys.argv[2].encode()
output_path = sys.argv[3]
elif len(sys.argv) == 2:
input_image = bytearray()
tag = bytearray((0,) * 4)
output_path = sys.argv[1]
else:
print(usage_message) print(usage_message)
sys.exit(-1) sys.exit(-1)
input_image = read_image(sys.argv[1])
tag = sys.argv[2].encode()
output_path = sys.argv[3]
if len(tag) != 4: if len(tag) != 4:
print(usage_message) print(usage_message)
sys.exit(-2) sys.exit(-2)