brightnessFromImage static method
Implementation
static double brightnessFromImage(Uint8List bytes, int width, int height) {
int total = 0;
for (int i = 0; i < bytes.length; i += 4) {
int r = bytes[i];
int g = bytes[i + 1];
int b = bytes[i + 2];
total += (r + g + b) ~/ 3;
}
double average = total / (width * height);
return average;
}