static byte[] ocr_leftProfile_scaledTo127(int n, double stopAtRatio, BWImage img) { int w = img.getWidth(), h = img.getHeight(); int stopAt = min(w-1, iround(w*stopAtRatio)); byte[] out = new byte[n]; for y to n: { int realY = ifloor(y*h/n); int x = 0; while (x <= stopAt && img.getPixel(x, realY) > 0.5f) ++x; printVars_str(+realY, +stopAt, +x); out[y] = (byte) iround(x*127.0/stopAt); } ret out; }