If I understand the question correctly, you want to get the single bytes of the jpg-file, which can be read with a DataInputStream
:
File imageFile;
DataInputStream dis = new DataInputStream(new FileInputStream(imageFile));
int input = dis.read();
dis.close();
input
then holds the first byte of the file, if you invoke read
again (before dis.close()
), you can read the subsequent bytes. Next, you would have to manipulate them and finally, you can write them to this or another file with a DataOutputStream
that works just like the corresponding input stream. Just do NOT forget to close the streams after you are done reading or writing, so that system resources are freed and the files are closed. Otherwise the written data could be lost.
4
solved Convert image to binary to apply Image Steganography [closed]