how to iterate pixels image java

Solutions on MaxInterview for how to iterate pixels image java by the best coders in the world

showing results for - "how to iterate pixels image java"
Antonin
15 Jan 2020
1for (int y = 0; y < image.getHeight(); y++) {
2    for (int x = 0; x < image.getWidth(); x++) {
3          int  clr   = image.getRGB(x, y); 
4          int  red   = (clr & 0x00ff0000) >> 16;
5          int  green = (clr & 0x0000ff00) >> 8;
6          int  blue  =  clr & 0x000000ff;
7          image.setRGB(x, y, clr);
8    }
9}