How Convert a Byte array to a image format
--------------------------------------------------------------------------------
Hi,
How to convert a Byte array to an image format....I shall be more about my question and what i want...See i recieve a Byte array fom server this Byte array before recieveing at my end it was converted from an image/text format into a Byte array and is sent from server and, I recieve this Byte array now I have to convert this Byte array into their respective image....please tell me how to convert a Byte array to a image ......... Kindly explain clearly as i am new to Java......
Thanking You.
Re: How Convert a Byte array to a image format
Quote:
Originally Posted by
perlWhite
How to convert a Byte array to an image format....
It's very simple really. You know what the byte array holds and you convert it to a new byte array holding what it's been converted to.
This requires knowledge of what you have and what you want. You convert data of one type to data of another type. That's all there's to it really.
Re: How Convert a Byte array to a image format
its still not clear for me....can please explain with a code......
Re: How Convert a Byte array to a image format
You can create a ByteArrayInputStream from the byte array and then read the image from the input stream using the ImageIO class:
Code:
InputStream is = new ByteArrayInputStream(byteArray);
BufferedImage image = ImageIO.read(is);
Less is more...
M. van der Rohe