You can get an array of int
from the initial image:
int[] pixels = newImage.getRGB(0, 0, 100, 100, null, 0, 100);
which means get RGB values from (0,0) to (100,100) in a new array, starting from index 0, offsetting index for each line of 100.
Then for each int
in pixels
, the grayscale value is given by:
int gray = pixels[i] & 0xFF;