public static boolean isBlack(BufferedImage var0, int var1, int var2, int var3) {
        double var8 = 0.0D;
        if (var1 >= 0 && var2 >= 0 && var1 <= var0.getWidth() && var2 <= var0.getHeight()) {
            try {
                int var4 = var0.getRGB(var1, var2);
                int var5 = var4 >> 16 & 255;
                int var6 = var4 >> 8 & 255;
                int var7 = var4 & 255;
                var8 = (double) var5 * 0.299D + (double) var6 * 0.587D + (double) var7 * 0.114D;
            } catch (Exception var11) {
                LOG.warn("", var11);
            }

            return var8 < (double) var3;
        } else {
            return false;
        }
    }
Copied and pasted from Tess4j (https://sourceforge.net/projects/tess4j/)
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/tess4j/ImageUtil.java