Hello.
I want to convert any image file to binary file.
How can I do it?
please help.
Thank You!!
Printable View
Hello.
I want to convert any image file to binary file.
How can I do it?
please help.
Thank You!!
An "image" file is a "binary" file. Now what is it you actually want to know?
Okay.. Thats right.. But I would like to convert the image file for example, An jpeg file into form of file containing 1 and 0. in other words, i want to see the binary representation of that original file as an input.
So use an FileInputStream and read it byte by byte and use the Integer.toBinaryString method to create the binary representation of that byte (don't forget to left pad zeros to a length of 8 for each and every byte) and then write that back into another file.
Thank you.
your reply looks promising. But I am quite new to java, so i am looking into it.
But if u can help me in further detail, that would be of great help to me.
Alright.. Now i have managed to read the image using fileinputstream ... And stored it in byte array. now how can I proceed with the byte array?