Convert image and audio files to binary in Java -
Convert image and audio files to binary in Java -
i want convert image , sound file binary stream, process , reconstruct image same binary stream in java. how can that? has worked on this? please help me out possible. hints or pseudocode highly appreciated. how tried creates empty file while reconstructing image. image binary:-
file file = new file("e:\\image.jpg"); bufferedimage img = imageio.read(file); // write image byte array in-memory (jpg format) bytearrayoutputstream b = new bytearrayoutputstream(); imageio.write(img, "jpg", b); byte[] jpgbytearray = b.tobytearray(); // convert string 0s , 1s stringbuilder sb = new stringbuilder(); (byte : jpgbytearray) { sb.append(integer.tobinarystring(by & 0xff));
for binary image:-
byte[] original = obj.orig_seq.getbytes(); inputstream in = new bytearrayinputstream(original); bufferedimage img = imageio.read(in); imageio.write(img, "jpg", new file("e:\\mypic_new.jpg"));
image image-processing binary
Comments
Post a Comment