Skip to content

Instantly share code, notes, and snippets.

public static boolean isDark(Bitmap bitmap) {
final float darkThreshold = bitmap.getWidth() * bitmap.getHeight() * 0.45f;
final int w = bitmap.getWidth();
final int h = bitmap.getHeight();
int darkPixels = 0;
int[] lineColor = new int[w];
for (int i = 0; i < h - 1; i++) {
bitmap.getPixels(lineColor, 0, w, 0, i, w, 1);
for (int color : lineColor) {