I have an
applet where i get an image the form of byte array .I use the createImage() of awt toolkit to create an image using the byte array .The image loads properly in applet and now i change the image using filters and convert the modified image into a byte array using the following code
/****
private byte[] convertImage(Image img)
{
try
{
int[] pix = new int[img.getWidth(null) * img.getHeight(null)];
PixelGrabber pg = new PixelGrabber(img, 0, 0, img.getWidth(null), img.getHeight(null), pix, 0, img.getWidth(null));
pg.grabPixels();
byte[] pixels = new byte[img.getWidth(null) * img.getHeight(null)];
for (int j = 0; j < pix.length; j++)
{
pixels[j] = new Integer(pix[j]).byteValue();
}
System.out.println("pixels.length = " + pixels.length);
return pixels;
}
catch (InterruptedException e)
{
e.printStackTrace();
}
return null;
}
****/
I send this byte array over to a
servlet and write it to a file using file outputstream. The file is created at the location but i am not able to see the modified picture when i open the file in IE or any other editor.
Please suggest what to do ?