Hi.,
I would like to display Jpeg image which store in byte array. since
MemoryImageSource is only capable of managing a RGB memory image
like the example below. I do not want to save byte array into harddisc and
load it back. How to rendering image byte array for display?? I am new to Java, Please Help

int w = 320;
int h = 240;
int pix[] = new int[w * h];
int index = 0;
for (int y = 0; y < h; y++) {
int red = (y * 255) / (h - 1);
for (int x = 0; x < w; x++) {
int blue = (x * 255) / (w - 1);
pix[index++] = (255 << 24) | (red << 16) | blue;
}
}

Graphics g = Panel1.getGraphics();
Graphics2D g2 = (Graphics2D) g;
Image img = createImage(new MemoryImageSource(w, h, pix, 0, w));
g2.drawImage (img, 0,0, null);