> It has been at most one hour that I look for a RGB representation of an
> image. I have found BufferedImage, but this class doesn't really do what I
[quoted text clipped - 7 lines]
> do you have an idea where to get something like that? (a class for
> exemple?? )
To get the RGB pixels of a BufferedImage into one or more int arrays you can
use method
public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray,
int offset, int scansize)
of class BufferedImage. (see the javadoc)
For example, to get all the pixels into one large array:
BufferedImage image = ...;
int w = image.getWidth();
int h = image.getHeight();
int rgbArray[] = new int[w * h];
image.getRGB(0, 0, w, h, rgbArray, 0, w);
If instead you want to get the pixels into several subarrays, you would need
to call image.getRGB(...) several times.

Signature
"TFritsch$t-online:de".replace(':','.').replace('$','@')
Marcelo - 15 Nov 2005 00:22 GMT
Thanks a lot,
I have just another remaining question. So, for having a 3D matrix for
the RGB representation, I should call the function several times, but
how is the return type? Do I get first all the R values, then the G
values and at last the B values?
RRRRRRRRRRRGGGGGGGGGGGGGGBBBBBBBBBBB
or is it different ?
thanks a lot,
Marcelo
int r
> To get the RGB pixels of a BufferedImage into one or more int arrays you can
> use method
[quoted text clipped - 9 lines]
> If instead you want to get the pixels into several subarrays, you would need
> to call image.getRGB(...) several times.
Thomas Fritsch - 15 Nov 2005 02:26 GMT
> I have just another remaining question. So, for having a 3D matrix for the
> RGB representation, I should call the function several times, but how is
[quoted text clipped - 4 lines]
>
> or is it different ?
It is different (something like ARGBARGBARGB...).
When calling BufferedImage.getRGB(..., rgbArray, ...) you get an ARGB value
in each array element of your int[] array. The first int contains the ARGB
value of the first pixel, the second int the ARGB value of the second pixel,
...
Each int contains a packed ARGB value: 8 bits for A (the opacity), 8 bits
for R, 8 bits for G, 8 bits for B.

Signature
"TFritsch$t-online:de".replace(':','.').replace('$','@')
>I would like to get something like
>
>int [][][] matrixRGB;
>matrixRGB = image.getRGB_Representation();
PixelGrabber is used for extracting rgb bits from rectangles in an
image.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.