|
-
August 22nd, 2009, 12:13 PM
#1
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.
-
August 22nd, 2009, 07:36 PM
#2
Re: How Convert a Byte array to a image format
 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.
-
August 22nd, 2009, 11:10 PM
#3
Re: How Convert a Byte array to a image format
its still not clear for me....can please explain with a code......
-
August 23rd, 2009, 04:28 AM
#4
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
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|