static Pair unsubtitle(BWImage img) { int h = img.getHeight(), y1 = h-12; if (y1 < 0) null; int w = img.getWidth(); int x1 = w, x2 = 0; for (int x = 0; x < w; x++) if (img.getPixel(x, y1) < 0.5) { x1 = min(x1, x); x2 = max(x2, x+1); if (img.getPixel(x, h-1) >= 0.5) null; } else if (img.getPixel(x, h-1) < 0.5) null; if (x1 > x2) null; BWImage sub = img.clip(x1-1, y1, x2-x1+2, h-y1); //showBWImage(sub); S text = imageToUtf(sub); ret pair(img.clip(0, 0, w, y1), text); }