diff --git a/src/main/java/net/sourceforge/tess4j/Tesseract1.java b/src/main/java/net/sourceforge/tess4j/Tesseract1.java index ab474c2..ee4657f 100644 --- a/src/main/java/net/sourceforge/tess4j/Tesseract1.java +++ b/src/main/java/net/sourceforge/tess4j/Tesseract1.java @@ -547,7 +547,7 @@ protected void setImage(RenderedImage image) throws IOException { */ protected void setImage(int xsize, int ysize, ByteBuffer buf, int bpp) { int bytespp = bpp / 8; - int bytespl = (int) Math.ceil(xsize * bpp / 8.0); + int bytespl = buf.capacity() / ysize; TessBaseAPISetImage(handle, buf, xsize, ysize, bytespp, bytespl); }