private static void doAnalysis(String outfile, Level level) throws TesseractException, IOException {
        layout = analyzer.analyzeLayout();
        
        do {
            BoundingBox box = layout.getBoundingBox(level);
            if (box == null) {
                // If the bounding box is null, this indicates that there is no content 
                // of the specified level at the analyzer's current index. For now, we'll
                // just skip this. Tesseract may advance the iterator and report success, 
                // with out there actually being any content under the iterator.
                //
                // In the future, we'll need to smooth over this oddity.
                continue;
            }
            
            g.drawRect(box.left, box.top, box.right - box.left, box.bottom - box.top);
            System.out.println(level + " :: " + layout.getBlockType());
        } while (layout.next(level));
        
        ImageIO.write(image, "jpg", new File(outfile));
    }