Read binary data from an image and save it with JavaScript
I want to read the binary data of an image and then save it again to my local disk with JavaScript. I wrote a small demo that shows this use-case. To read the file I use readAsBinaryString from the File Reader API (HTML5) to get the binary data. I write the binary string into a textfield from which I then read the data again to write it to a file. If I save the file my images (I tested several JPEGs) are broken so you cannot see anything useful. Can it be that "readAsBinaryString" makes a conversion which makes the binary data incorrect? To have a look at my demo application I made a fiddle .