/**
  * Test of TessBaseAPIRect method, of class TessDllAPI1.
  *
  * @throws Exception while processing the image
  */
 @Test
 public void testTessBaseAPIRect() throws Exception {
   logger.info("TessBaseAPIRect");
   String expResult = expOCRResult;
   File tiff = new File(this.testResourcesDataPath, "eurotext.tif");
   BufferedImage image = ImageIO.read(tiff); // require jai-imageio lib to read TIFF
   ByteBuffer buf = ImageIOHelper.convertImageData(image);
   int bpp = image.getColorModel().getPixelSize();
   int bytespp = bpp / 8;
   int bytespl = (int) Math.ceil(image.getWidth() * bpp / 8.0);
   TessAPI1.TessBaseAPIInit3(handle, datapath, language);
   TessAPI1.TessBaseAPISetPageSegMode(handle, TessPageSegMode.PSM_AUTO);
   Pointer utf8Text = TessAPI1.TessBaseAPIRect(handle, buf, bytespp, bytespl, 0, 0, 1024, 800);
   String result = utf8Text.getString(0);
   TessAPI1.TessDeleteText(utf8Text);
   logger.info(result);
   assertEquals(expResult, result.substring(0, expResult.length()));
 }