I'm trying to extract the binary information from an image (like \ xff
), and save it into a text file. Ultimately, I should also be able to reverse the effect, and generate an image from the text file.
I'm using the code below to try to create the text file; it does not throw an error, but the text generated does not generate an image. Here is an example of the contents of one of the text files created by this code.
file = open(image, "rb")
data = file.read()
file.close()
file = open(txt file, "w")
file.write(str(data))
file.close()