tesseract icon indicating copy to clipboard operation
tesseract copied to clipboard

Pix Xres and Yres are always 0 on a Linux system

Open ferronsw opened this issue 6 years ago • 1 comments

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.

ferronsw avatar May 21 '19 11:05 ferronsw

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).

charlesw avatar Oct 12 '19 08:10 charlesw