Question: I use an interface of RenderedImage for reading a tif image.
How can I get all rgb values of this picture in a 2d-Array like this:

```
red[0][128] = 120; // means x=0, y=128, red value = 120
// the value 120 is the value I have to determine (and oall other rgb values)!

```

Does anyone know this?

Thanks a lot for your help!

Answer: 
`getData()` returns a `Raster`, which has a `getData()` method.

Can you call `YourRenderedImage.getData().getPixel(int x, int y, int iArray[])` to get your RGB values?

JavaDoc: Returns the samples in an array of int for the specified pixel. An ArrayIndexOutOfBoundsException may be thrown if the coordinates are not in bounds.

[Raster.getPixel() - JavaDoc](http://java.sun.com/j2se/1.3/docs/api/java/awt/image/Raster.html#getPixel(int,%20int,%20int[]))

I believe the elements returned by the `int` array represent: Red, Green, Blue, Alpha, and Hex key, but I don't know for sure.
Like [Abboq](https://stackoverflow.com/users/244168/abboq), I thought you wanted to traverse the `Raster`, which should work. Alternatively, you might be able to use [`BandSelect`](http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-unc/Image-manipulation.doc.html#63344) to get each of the three bands you want.

```
RenderedImage[] dst = new RenderedImage[3];
int[] bandIndices = new int[1];
for (int i = 0; i < 3; i++) {
    bandIndices[0] = i;
    pb = new ParameterBlock();
    pb.addSource(src);
    pb.add(bandIndices);
    dst[i] = (RenderedImage) JAI.create("bandSelect", pb);
}

```