the question is, how to stack that r value in array so i can sum all of it and find the average value
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int p = img.getRGB(x, y);
int a = (p >> 24) & 0xff;
* * int r = (p >> 16) & 0xff; * * //this red
int g = (p >> 8) & 0xff;
int b = (p >> 0) & 0xff;
mainform1.pixelValueTextArea.append("height: " + y + " width: " + x + " red: " + r + " green: " + g + " blue: " + b + "\n");
jlab.setIcon(new ImageIcon(f.toString()));
jlab.setHorizontalAlignment(JLabel.CENTER);
mianform1.captureImageScrollPane.getViewport().add(jlab);
}
}
(all i want to do is get average RGB and show it in my mainform)
any suggestion?