Class PixelIterator

Object
PixelIterator

public class PixelIterator extends Object
A row-major iterator over sample values in a Raster or RenderedImage. For any image (tiled or not), this class iterates first over the bands, then over the columns and finally over the rows. If the image is tiled, then this iterator will perform the necessary calls to the RenderedImage.getTile(int, int) method for each row in order to perform the iteration as if the image was untiled.

On creation, this iterator is positioned before the first sample value. To use this iterator, invoke the next() method in a while loop as below:

PixelIterator it = new PixelIterator(image);
while (it.next()) {
    float value = it.getSampleFloat();
    // Do some processing with the value here...
}
Since:
3.1
See Also: