Get RGB array from image

R

Riri

Hello, i have an image, and i'd like to obtain a table in which i store RGB
values of each pixel, and then create an another image from a
MemoryImageSource using that table. I don't know how to manage it, any idea?

Thanks
Melina

Image image2 = getToolkit().getImage("D:/Temp/b.jpg");

//Création du tableau pixel image et affichage
int w = 256;
int h = 256;
int pix[] = new int[w*h];
int index = 0;
for (int y = 0; y < h*w; y++) {
pix[index++] = ???
}
Image image = createImage(new MemoryImageSource(w, h, pix, 0, w));
 
A

Andrew Thompson

"Riri"...
| Hello,

Hello Riri, can I ask some things of you?

1) Stick with the threads you start, rather than
openning new ones for the same question.

2) http://www.physci.org/codes/sscce.jsp
(Your snippets are little more than useless)

3) Phrase your question of the form
"How Do I ...?" rather than "Do you know ....?"
 
A

ak

Riri said:
Hello, i have an image, and i'd like to obtain a table in which i store RGB
values of each pixel, and then create an another image from a
MemoryImageSource using that table. I don't know how to manage it, any idea?

Thanks
Melina

Image image2 = getToolkit().getImage("D:/Temp/b.jpg");

//Création du tableau pixel image et affichage
int w = 256;
int h = 256;
int pix[] = new int[w*h];
int index = 0;
for (int y = 0; y < h*w; y++) {
pix[index++] = ???
}
Image image = createImage(new MemoryImageSource(w, h, pix, 0, w));
Look at PixelGrabber
 
R

Riri

Thanks i'll try to use PixelGrabber.
R.
ak said:
Riri said:
Hello, i have an image, and i'd like to obtain a table in which i store RGB
values of each pixel, and then create an another image from a
MemoryImageSource using that table. I don't know how to manage it, any idea?

Thanks
Melina

Image image2 = getToolkit().getImage("D:/Temp/b.jpg");

//Création du tableau pixel image et affichage
int w = 256;
int h = 256;
int pix[] = new int[w*h];
int index = 0;
for (int y = 0; y < h*w; y++) {
pix[index++] = ???
}
Image image = createImage(new MemoryImageSource(w, h, pix, 0, w));
Look at PixelGrabber
--

____________

http://reader.imagero.com the best java image reader.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top