I would like to convert the below hex sequences to images, in the process of sifting through quite a number of problems that are similar to mine none have come close as to that solved in https://stackoverflow.com/a/33989302/13648455, my code is below, where could I be going wrong?
data = "2a2b2c2a2b2c2a2b2c2a2b2cb1"
buf = io.StringIO()
for line in data.splitlines():
line = line.strip().replace(" ", "")
if not line:
continue
bytez = binascii.unhexlify(line)
buf.write(bytez)
with open("image.jpg", "wb") as f:
f.write(buf.getvalue())