- int moduleEnd = borderWidth;
- while (moduleEnd < minDimension && image.get(moduleEnd, moduleEnd)) {
- moduleEnd++;
+ //int moduleEnd = borderWidth;
+ int[] leftTopBlack = image.getTopLeftOnBit();
+ if (leftTopBlack == null) {
+ throw NotFoundException.getNotFoundInstance();
+ }
+ int x = leftTopBlack[0];
+ int y = leftTopBlack[1];
+ while (x < minDimension && y < minDimension && image.get(x, y)) {
+ x++;
+ y++;