Your question could mean almost anything.
Define:
1. image
2. XML format
3. convert
What are you hoping to store? Pixels? Lines? OCRed text?
What format are you trying to get it into? A proprietary one?
What sort of image do you mean? Raster? Vector? java.awt.Image?
You best bet is probably base64 encoding. You can use the codec library from apache commons.
That turns binary into ASCII with only 33% increase in length (3 bytes becomes 4 characters.
You should be OK putting that into you XML as bare text (though you might be even safer with <![CDATA[]]>
thanx 4 ur respone still im not getting full solution to my problem
im doing conversion like this
some ".gif" to byte[]
here my code is like this...
byte[] buffer = null;
try {
BufferedImage image = ImageIO.read(this.getClass().getResource("images/someimage.jpg"));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ImageIO.write(image, "jpg", bos);
buffer = bos.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
then iam converting byte to string by base 64
string to byte by base 64
byte b to awt image like this
ByteArrayInputStream bis = new ByteArrayInputStream(b);
Image mynewImage = ImageIO.read(bis);
image what im getting is not looking like original image.
help me to overcome.......... :)