From what I understand (I could be wrong) Pix.LoadFromFile
is the only way to get Pix for processing. is there any other way, such as from a bitmap?
Asked
Active
Viewed 1.2k times
5

Julien Roncaglia
- 17,397
- 4
- 57
- 75

Slime recipe
- 2,223
- 3
- 32
- 49
-
1I am not professional in tesseract, but what about: Bitmap bmp = (Bitmap)Bitmap.FromFile(MyImgFilePath); Pix img = PixConverter.ToPix(bmp); – houssam Oct 02 '14 at 15:05
-
Why don't you post this as an answer and then you can get some SO gold. as this PixConverter.ToPix is exactly what I was looking for. thanks. – Slime recipe Oct 03 '14 at 05:30
-
you are welcome. as I mentioned before, I am not professional in tesseract, So I didn't post the answer hoping that someone else can give us more details about getting Pix(s). now I can post it as answer. – houssam Oct 03 '14 at 08:01
1 Answers
8
I am not professional in tesseract, but you can use the following:
Bitmap bmp = (Bitmap)Bitmap.FromFile(MyImgFilePath);
Pix img = PixConverter.ToPix(bmp);
you can take a look at source code of PixConverter at :
https://github.com/charlesw/tesseract/blob/master/src/Tesseract/PixConverter.cs

houssam
- 1,823
- 15
- 27
-
If anybody is encountering `System.IO.IOException: Failed to load image` exceptions when using `Pix.LoadFromFile` or `Pix.LoadFromMemory` - use this approach. – Adam C Jan 21 '22 at 17:47