tesseract
tesseract copied to clipboard
Pix Xres and Yres are always 0 on a Linux system
I load .tiff files from memory to create a instance of Pix. In Windows everything goes well, but on linux I get a warning:
Warning Invalid resolution 0 dpi. Using 70 instead.
I've created a work around to set the Pix Xres and Yres property manually.
var pix = Pix.LoadTiffFromMemory(tiffBytes);
using (Graphics gr = Graphics.FromImage(bmp))
{
pix.XRes = Convert.ToInt32(gr.DpiX);
pix.YRes = Convert.ToInt32(gr.DpiY);
}
I'm using 3.3.0, so I don't know if the same warning occurs in 4.0. Hope it helps someone.
It mustn't be supported in that version of leptonica, we just use pixReadMemTiff. I've just released version 4.1 (targeting tesseract 4.1 and leptonica 1.78) which might resolve the issue. While it's currently in beta it should be pretty stable with the exception of the known issues (https://github.com/charlesw/tesseract/blob/develop/ChangeLog.md).