You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by Peter Kronenberg <pe...@torch.ai> on 2020/12/30 20:00:14 UTC
Using Tesseract with Tika
I'm trying to use Tesseract with Tika and not having much luck. I have Tesseract working from the command line.
Below is the Tika code I'm using.
Is ImageMagick a pre-requisite on Windows? It complained that it needed the path. Does it use this?
I also noticed that putting an incorrect path for TesseractPath (and I assume ImageMagickPath) doesn't result in an error. It would be nice if you check at least that the path is correct. But having said that, I double-checked the path to Tesseract and it is definitely correct
[public class TikaOCRParser { private static final PDFParserConfig pdfConfig = new PDFParserConfig(); private static final TesseractOCRConfig tessConfig = new TesseractOCRConfig(); static { pdfConfig.setOcrDPI(100); pdfConfig.setDetectAngles(true); pdfConfig.setExtractInlineImages(true); pdfConfig.setOcrStrategy(PDFParserConfig.OCR_STRATEGY.OCR_ONLY); tessConfig.setLanguage("eng"); tessConfig.setEnableImageProcessing(1); tessConfig.setTesseractPath("c:\\Program Files\\Tesseract-OCR"); tessConfig.setImageMagickPath("c:\\Program Files\\ImageMagick-7.0.10-Q16-HDRI"); } private static final AutoDetectParser parser = new AutoDetectParser(); private static final ParseContext parseContext = new ParseContext(); static { parseContext.set(AutoDetectParser.class, parser); parseContext.set(PDFParserConfig.class, pdfConfig); parseContext.set(TesseractOCRConfig.class, tessConfig); } public static String parse(String file) throws TikaException, SAXException, IOException { ContentHandler handler = new BodyContentHandler(-1); Metadata metadata = new Metadata(); try (TikaInputStream stream = TikaInputStream.get(new BufferedInputStream(new FileInputStream(file)))) { parser.parse(stream, handler, metadata, parseContext); } //Arrays.stream(metadata.names()).filter(n -> !metadata.get(n).isEmpty()).forEach(n -> log.info(String.format("%s: %s", n, metadata.get(n)))); return handler.toString(); } public static void main(String[] args) throws TikaException, SAXException, IOException { String file = "c:\\testFiles\\imagetext.png"; System.out.println("Text: " + parse(file)); } }]
Re: Using Tesseract with Tika
Posted by Tim Allison <ta...@apache.org>.
Got it. Let's discuss on https://issues.apache.org/jira/browse/TIKA-3260
On Mon, Jan 4, 2021 at 5:21 PM Peter Kronenberg <pe...@torch.ai>
wrote:
> Thanks for you indulgence 😊
>
>
>
> I went ahead and installed python2 and all the pre-reqs. I used the
> 32-bit version which apparently doesn’t have the numpy problem described by
> https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html.
> And I made sure that it was in my path. But I am still not getting
> automatic de-skewing.
>
>
>
>
>
> *From:* Tim Allison <ta...@apache.org>
> *Sent:* Monday, January 4, 2021 5:07 PM
> *To:* Peter Kronenberg <pe...@torch.ai>; user@tika.apache.org
> *Subject:* Re: Using Tesseract with Tika
>
>
>
> I'm playing along at home. Thank you for the example file. I'm finding a
> number of similar items. This is not an area of the codebase that I had
> exercised before. Will open issues as appropriate.
>
>
>
> On Mon, Jan 4, 2021 at 4:48 PM Peter Kronenberg <pe...@torch.ai>
> wrote:
>
> More about Python. Does it need to be python 2 or 3? I see in the code
> at
> https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
> that you are executing is “python”, which makes me think it won’t work if
> you have “python3”
>
> On my Windows system, if I install python3, I can execute with “python”.
> But on Linux, there seems to be more of a distinction
>
>
>
> But it remains that I have python on my Window system. I’ve successfully
> installed the pre-reqs and automatic de-skewing is not working.
>
> I read about the Windows bug and I’m not sure if it will cause a problem
> for this particular case, although I don’t really know too much about it.
> Not sure if the bug is just a very specific use case or not
>
>
>
>
>
>
>
> *From:* Peter Kronenberg <pe...@torch.ai>
> *Sent:* Monday, January 4, 2021 1:35 PM
> *To:* user@tika.apache.org; tallison@apache.org
> *Subject:* RE: Using Tesseract with Tika
>
>
>
> This email was sent from outside your organisation, yet is displaying the
> name of someone from your organisation. This often happens in phishing
> attempts. Please only interact with this email if you know its source and
> that the content is safe.
>
>
>
> Great, thanks. So deskewing should be handled automatically for both
> images and images within PDFs, Word, etc?
>
>
>
> I’m not seeing that. I have the path of ImageMagick specified, but for
> the attached image, which is skewed 5 degrees, the output I’m getting is
>
> [image: <title></title> </head> <body><div class="ocr">This is an example
> of an image rather th a non-text-searchable PDF PDF reader a text document
> Ie attempting to select the Because it w an innot be rendered text on the S
> created from as plain text by the Page as though it were a how neatly it is
> orga ebsite will not work, regardless of anized, </div> </body></html>]
>
> Why is it only a pre-req on Windows systems? Should it be specified for
> non-Windows as well?
>
>
>
> And as I mentioned, some better error-checking would be appreciated 😊.
> If, for example, an incorrect path is given. Looks like the code is doing
> all these checks, but not telling the user
>
>
>
> Does Tika output any info message if Image Magick is detected? I’m not
> seeing anything, which could explain my results above. But I know I’m
> specifying the correct path.
>
> I also noticed some checking for Python. Is Python required to do the
> deskewing? I have Python, but maybe I’m missing some other dependencies.
> I’m not a Python guru, but my simple test
>
> tells me that maybe I’m missing something. Is there documentation for the
> specific Python setup needed?
>
>
>
> *From:* Tim Allison <ta...@apache.org>
> *Sent:* Monday, January 4, 2021 1:19 PM
> *To:* user@tika.apache.org
> *Subject:* Re: Using Tesseract with Tika
>
>
>
> If ImageMagick is installed, Tika does use it to normalize the image,
> density, depth, colorspace, sizing, rotating, filtering...
>
>
>
>
> https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
>
>
>
>
>
> On Mon, Jan 4, 2021 at 12:34 PM Peter Kronenberg <
> peter.kronenberg@torch.ai> wrote:
>
> Hi, hopefully this email got lost in the cracks of the holidays.
>
>
>
> Just wondering about the dependency on Image Magick? Why exactly is it
> needed? Does Tika use ImageMagick at all?
>
>
>
> *From:* Peter Kronenberg
> *Sent:* Wednesday, December 30, 2020 3:52 PM
> *To:* user@tika.apache.org
> *Subject:* RE: Using Tesseract with Tika
>
>
>
> I figured out that I also need to set the location of setTessdataPath().
> Would have been nice to get an error message if I request OCR processing
> (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are
> missing required information 😊
>
>
>
> Would still like to understand more about how ImageMagick is used
>
>
>
> *From:* Peter Kronenberg
> *Sent:* Wednesday, December 30, 2020 3:00 PM
> *To:* user@tika.apache.org
> *Subject:* Using Tesseract with Tika
>
>
>
> I’m trying to use Tesseract with Tika and not having much luck. I have
> Tesseract working from the command line.
>
> Below is the Tika code I’m using.
>
>
>
> Is ImageMagick a pre-requisite on Windows? It complained that it needed
> the path. Does it use this?
>
>
>
> I also noticed that putting an incorrect path for TesseractPath (and I
> assume ImageMagickPath) doesn’t result in an error. It would be nice if
> you check at least that the path is correct. But having said that, I
> double-checked the path to Tesseract and it is definitely correct
>
>
>
>
>
>
RE: Using Tesseract with Tika
Posted by Peter Kronenberg <pe...@torch.ai>.
Thanks for you indulgence 😊
I went ahead and installed python2 and all the pre-reqs. I used the 32-bit version which apparently doesn’t have the numpy problem described by https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html. And I made sure that it was in my path. But I am still not getting automatic de-skewing.
[cid:image005.png@01D6E2BD.F0DCD930]
From: Tim Allison <ta...@apache.org>
Sent: Monday, January 4, 2021 5:07 PM
To: Peter Kronenberg <pe...@torch.ai>; user@tika.apache.org
Subject: Re: Using Tesseract with Tika
I'm playing along at home. Thank you for the example file. I'm finding a number of similar items. This is not an area of the codebase that I had exercised before. Will open issues as appropriate.
On Mon, Jan 4, 2021 at 4:48 PM Peter Kronenberg <pe...@torch.ai>> wrote:
More about Python. Does it need to be python 2 or 3? I see in the code at https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387 that you are executing is “python”, which makes me think it won’t work if you have “python3”
On my Windows system, if I install python3, I can execute with “python”. But on Linux, there seems to be more of a distinction
But it remains that I have python on my Window system. I’ve successfully installed the pre-reqs and automatic de-skewing is not working.
I read about the Windows bug and I’m not sure if it will cause a problem for this particular case, although I don’t really know too much about it. Not sure if the bug is just a very specific use case or not
[cid:image001.png@01D6E2BD.895DF1E0]
From: Peter Kronenberg <pe...@torch.ai>>
Sent: Monday, January 4, 2021 1:35 PM
To: user@tika.apache.org<ma...@tika.apache.org>; tallison@apache.org<ma...@apache.org>
Subject: RE: Using Tesseract with Tika
This email was sent from outside your organisation, yet is displaying the name of someone from your organisation. This often happens in phishing attempts. Please only interact with this email if you know its source and that the content is safe.
Great, thanks. So deskewing should be handled automatically for both images and images within PDFs, Word, etc?
I’m not seeing that. I have the path of ImageMagick specified, but for the attached image, which is skewed 5 degrees, the output I’m getting is
[<title></title> </head> <body><div class="ocr">This is an example of an image rather th a non-text-searchable PDF PDF reader a text document Ie attempting to select the Because it w an innot be rendered text on the S created from as plain text by the Page as though it were a how neatly it is orga ebsite will not work, regardless of anized, </div> </body></html>]
Why is it only a pre-req on Windows systems? Should it be specified for non-Windows as well?
And as I mentioned, some better error-checking would be appreciated 😊. If, for example, an incorrect path is given. Looks like the code is doing all these checks, but not telling the user
Does Tika output any info message if Image Magick is detected? I’m not seeing anything, which could explain my results above. But I know I’m specifying the correct path.
I also noticed some checking for Python. Is Python required to do the deskewing? I have Python, but maybe I’m missing some other dependencies. I’m not a Python guru, but my simple test
[cid:image003.png@01D6E2BD.895DF1E0]
tells me that maybe I’m missing something. Is there documentation for the specific Python setup needed?
From: Tim Allison <ta...@apache.org>>
Sent: Monday, January 4, 2021 1:19 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: Re: Using Tesseract with Tika
If ImageMagick is installed, Tika does use it to normalize the image, density, depth, colorspace, sizing, rotating, filtering...
https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
On Mon, Jan 4, 2021 at 12:34 PM Peter Kronenberg <pe...@torch.ai>> wrote:
Hi, hopefully this email got lost in the cracks of the holidays.
Just wondering about the dependency on Image Magick? Why exactly is it needed? Does Tika use ImageMagick at all?
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:52 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: RE: Using Tesseract with Tika
I figured out that I also need to set the location of setTessdataPath(). Would have been nice to get an error message if I request OCR processing (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are missing required information 😊
Would still like to understand more about how ImageMagick is used
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:00 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: Using Tesseract with Tika
I’m trying to use Tesseract with Tika and not having much luck. I have Tesseract working from the command line.
Below is the Tika code I’m using.
Is ImageMagick a pre-requisite on Windows? It complained that it needed the path. Does it use this?
I also noticed that putting an incorrect path for TesseractPath (and I assume ImageMagickPath) doesn’t result in an error. It would be nice if you check at least that the path is correct. But having said that, I double-checked the path to Tesseract and it is definitely correct
[cid:image004.png@01D6E2BD.895DF1E0]
Re: Using Tesseract with Tika
Posted by Tim Allison <ta...@apache.org>.
I'm playing along at home. Thank you for the example file. I'm finding a
number of similar items. This is not an area of the codebase that I had
exercised before. Will open issues as appropriate.
On Mon, Jan 4, 2021 at 4:48 PM Peter Kronenberg <pe...@torch.ai>
wrote:
> More about Python. Does it need to be python 2 or 3? I see in the code
> at
> https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
> that you are executing is “python”, which makes me think it won’t work if
> you have “python3”
>
> On my Windows system, if I install python3, I can execute with “python”.
> But on Linux, there seems to be more of a distinction
>
>
>
> But it remains that I have python on my Window system. I’ve successfully
> installed the pre-reqs and automatic de-skewing is not working.
>
> I read about the Windows bug and I’m not sure if it will cause a problem
> for this particular case, although I don’t really know too much about it.
> Not sure if the bug is just a very specific use case or not
>
>
>
>
>
>
>
> *From:* Peter Kronenberg <pe...@torch.ai>
> *Sent:* Monday, January 4, 2021 1:35 PM
> *To:* user@tika.apache.org; tallison@apache.org
> *Subject:* RE: Using Tesseract with Tika
>
>
>
> This email was sent from outside your organisation, yet is displaying the
> name of someone from your organisation. This often happens in phishing
> attempts. Please only interact with this email if you know its source and
> that the content is safe.
>
>
>
> Great, thanks. So deskewing should be handled automatically for both
> images and images within PDFs, Word, etc?
>
>
>
> I’m not seeing that. I have the path of ImageMagick specified, but for
> the attached image, which is skewed 5 degrees, the output I’m getting is
>
> [image: <title></title> </head> <body><div class="ocr">This is an example
> of an image rather th a non-text-searchable PDF PDF reader a text document
> Ie attempting to select the Because it w an innot be rendered text on the S
> created from as plain text by the Page as though it were a how neatly it is
> orga ebsite will not work, regardless of anized, </div> </body></html>]
>
> Why is it only a pre-req on Windows systems? Should it be specified for
> non-Windows as well?
>
>
>
> And as I mentioned, some better error-checking would be appreciated 😊.
> If, for example, an incorrect path is given. Looks like the code is doing
> all these checks, but not telling the user
>
>
>
> Does Tika output any info message if Image Magick is detected? I’m not
> seeing anything, which could explain my results above. But I know I’m
> specifying the correct path.
>
> I also noticed some checking for Python. Is Python required to do the
> deskewing? I have Python, but maybe I’m missing some other dependencies.
> I’m not a Python guru, but my simple test
>
> tells me that maybe I’m missing something. Is there documentation for the
> specific Python setup needed?
>
>
>
> *From:* Tim Allison <ta...@apache.org>
> *Sent:* Monday, January 4, 2021 1:19 PM
> *To:* user@tika.apache.org
> *Subject:* Re: Using Tesseract with Tika
>
>
>
> If ImageMagick is installed, Tika does use it to normalize the image,
> density, depth, colorspace, sizing, rotating, filtering...
>
>
>
>
> https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
>
>
>
>
>
> On Mon, Jan 4, 2021 at 12:34 PM Peter Kronenberg <
> peter.kronenberg@torch.ai> wrote:
>
> Hi, hopefully this email got lost in the cracks of the holidays.
>
>
>
> Just wondering about the dependency on Image Magick? Why exactly is it
> needed? Does Tika use ImageMagick at all?
>
>
>
> *From:* Peter Kronenberg
> *Sent:* Wednesday, December 30, 2020 3:52 PM
> *To:* user@tika.apache.org
> *Subject:* RE: Using Tesseract with Tika
>
>
>
> I figured out that I also need to set the location of setTessdataPath().
> Would have been nice to get an error message if I request OCR processing
> (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are
> missing required information 😊
>
>
>
> Would still like to understand more about how ImageMagick is used
>
>
>
> *From:* Peter Kronenberg
> *Sent:* Wednesday, December 30, 2020 3:00 PM
> *To:* user@tika.apache.org
> *Subject:* Using Tesseract with Tika
>
>
>
> I’m trying to use Tesseract with Tika and not having much luck. I have
> Tesseract working from the command line.
>
> Below is the Tika code I’m using.
>
>
>
> Is ImageMagick a pre-requisite on Windows? It complained that it needed
> the path. Does it use this?
>
>
>
> I also noticed that putting an incorrect path for TesseractPath (and I
> assume ImageMagickPath) doesn’t result in an error. It would be nice if
> you check at least that the path is correct. But having said that, I
> double-checked the path to Tesseract and it is definitely correct
>
>
>
>
>
>
RE: Using Tesseract with Tika
Posted by Peter Kronenberg <pe...@torch.ai>.
More about Python. Does it need to be python 2 or 3? I see in the code at https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387 that you are executing is “python”, which makes me think it won’t work if you have “python3”
On my Windows system, if I install python3, I can execute with “python”. But on Linux, there seems to be more of a distinction
But it remains that I have python on my Window system. I’ve successfully installed the pre-reqs and automatic de-skewing is not working.
I read about the Windows bug and I’m not sure if it will cause a problem for this particular case, although I don’t really know too much about it. Not sure if the bug is just a very specific use case or not
[cid:image001.png@01D6E2B9.52E53AF0]
From: Peter Kronenberg <pe...@torch.ai>
Sent: Monday, January 4, 2021 1:35 PM
To: user@tika.apache.org; tallison@apache.org
Subject: RE: Using Tesseract with Tika
This email was sent from outside your organisation, yet is displaying the name of someone from your organisation. This often happens in phishing attempts. Please only interact with this email if you know its source and that the content is safe.
Great, thanks. So deskewing should be handled automatically for both images and images within PDFs, Word, etc?
I’m not seeing that. I have the path of ImageMagick specified, but for the attached image, which is skewed 5 degrees, the output I’m getting is
[<title></title> </head> <body><div class="ocr">This is an example of an image rather th a non-text-searchable PDF PDF reader a text document Ie attempting to select the Because it w an innot be rendered text on the S created from as plain text by the Page as though it were a how neatly it is orga ebsite will not work, regardless of anized, </div> </body></html>]
Why is it only a pre-req on Windows systems? Should it be specified for non-Windows as well?
And as I mentioned, some better error-checking would be appreciated 😊. If, for example, an incorrect path is given. Looks like the code is doing all these checks, but not telling the user
Does Tika output any info message if Image Magick is detected? I’m not seeing anything, which could explain my results above. But I know I’m specifying the correct path.
I also noticed some checking for Python. Is Python required to do the deskewing? I have Python, but maybe I’m missing some other dependencies. I’m not a Python guru, but my simple test
[cid:image007.png@01D6E2B8.E7DB7F30]
tells me that maybe I’m missing something. Is there documentation for the specific Python setup needed?
From: Tim Allison <ta...@apache.org>>
Sent: Monday, January 4, 2021 1:19 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: Re: Using Tesseract with Tika
If ImageMagick is installed, Tika does use it to normalize the image, density, depth, colorspace, sizing, rotating, filtering...
https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
On Mon, Jan 4, 2021 at 12:34 PM Peter Kronenberg <pe...@torch.ai>> wrote:
Hi, hopefully this email got lost in the cracks of the holidays.
Just wondering about the dependency on Image Magick? Why exactly is it needed? Does Tika use ImageMagick at all?
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:52 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: RE: Using Tesseract with Tika
I figured out that I also need to set the location of setTessdataPath(). Would have been nice to get an error message if I request OCR processing (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are missing required information 😊
Would still like to understand more about how ImageMagick is used
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:00 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: Using Tesseract with Tika
I’m trying to use Tesseract with Tika and not having much luck. I have Tesseract working from the command line.
Below is the Tika code I’m using.
Is ImageMagick a pre-requisite on Windows? It complained that it needed the path. Does it use this?
I also noticed that putting an incorrect path for TesseractPath (and I assume ImageMagickPath) doesn’t result in an error. It would be nice if you check at least that the path is correct. But having said that, I double-checked the path to Tesseract and it is definitely correct
[cid:image008.png@01D6E2B8.E7DB7F30]
RE: Using Tesseract with Tika
Posted by Peter Kronenberg <pe...@torch.ai>.
Great, thanks. So deskewing should be handled automatically for both images and images within PDFs, Word, etc?
I’m not seeing that. I have the path of ImageMagick specified, but for the attached image, which is skewed 5 degrees, the output I’m getting is
[<title></title> </head> <body><div class="ocr">This is an example of an image rather th a non-text-searchable PDF PDF reader a text document Ie attempting to select the Because it w an innot be rendered text on the S created from as plain text by the Page as though it were a how neatly it is orga ebsite will not work, regardless of anized, </div> </body></html>]
Why is it only a pre-req on Windows systems? Should it be specified for non-Windows as well?
And as I mentioned, some better error-checking would be appreciated 😊. If, for example, an incorrect path is given. Looks like the code is doing all these checks, but not telling the user
Does Tika output any info message if Image Magick is detected? I’m not seeing anything, which could explain my results above. But I know I’m specifying the correct path.
I also noticed some checking for Python. Is Python required to do the deskewing? I have Python, but maybe I’m missing some other dependencies. I’m not a Python guru, but my simple test
[cid:image005.png@01D6E29E.700C4210]
tells me that maybe I’m missing something. Is there documentation for the specific Python setup needed?
From: Tim Allison <ta...@apache.org>
Sent: Monday, January 4, 2021 1:19 PM
To: user@tika.apache.org
Subject: Re: Using Tesseract with Tika
If ImageMagick is installed, Tika does use it to normalize the image, density, depth, colorspace, sizing, rotating, filtering...
https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
On Mon, Jan 4, 2021 at 12:34 PM Peter Kronenberg <pe...@torch.ai>> wrote:
Hi, hopefully this email got lost in the cracks of the holidays.
Just wondering about the dependency on Image Magick? Why exactly is it needed? Does Tika use ImageMagick at all?
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:52 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: RE: Using Tesseract with Tika
I figured out that I also need to set the location of setTessdataPath(). Would have been nice to get an error message if I request OCR processing (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are missing required information 😊
Would still like to understand more about how ImageMagick is used
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:00 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: Using Tesseract with Tika
I’m trying to use Tesseract with Tika and not having much luck. I have Tesseract working from the command line.
Below is the Tika code I’m using.
Is ImageMagick a pre-requisite on Windows? It complained that it needed the path. Does it use this?
I also noticed that putting an incorrect path for TesseractPath (and I assume ImageMagickPath) doesn’t result in an error. It would be nice if you check at least that the path is correct. But having said that, I double-checked the path to Tesseract and it is definitely correct
[cid:image001.png@01D6E29C.D34DB8B0]
Re: Using Tesseract with Tika
Posted by Tim Allison <ta...@apache.org>.
If ImageMagick is installed, Tika does use it to normalize the image,
density, depth, colorspace, sizing, rotating, filtering...
https://github.com/apache/tika/blob/main/tika-parsers/tika-parsers-classic/tika-parsers-classic-modules/tika-parser-ocr-module/src/main/java/org/apache/tika/parser/ocr/TesseractOCRParser.java#L387
On Mon, Jan 4, 2021 at 12:34 PM Peter Kronenberg <pe...@torch.ai>
wrote:
> Hi, hopefully this email got lost in the cracks of the holidays.
>
>
>
> Just wondering about the dependency on Image Magick? Why exactly is it
> needed? Does Tika use ImageMagick at all?
>
>
>
> *From:* Peter Kronenberg
> *Sent:* Wednesday, December 30, 2020 3:52 PM
> *To:* user@tika.apache.org
> *Subject:* RE: Using Tesseract with Tika
>
>
>
> I figured out that I also need to set the location of setTessdataPath().
> Would have been nice to get an error message if I request OCR processing
> (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are
> missing required information 😊
>
>
>
> Would still like to understand more about how ImageMagick is used
>
>
>
> *From:* Peter Kronenberg
> *Sent:* Wednesday, December 30, 2020 3:00 PM
> *To:* user@tika.apache.org
> *Subject:* Using Tesseract with Tika
>
>
>
> I’m trying to use Tesseract with Tika and not having much luck. I have
> Tesseract working from the command line.
>
> Below is the Tika code I’m using.
>
>
>
> Is ImageMagick a pre-requisite on Windows? It complained that it needed
> the path. Does it use this?
>
>
>
> I also noticed that putting an incorrect path for TesseractPath (and I
> assume ImageMagickPath) doesn’t result in an error. It would be nice if
> you check at least that the path is correct. But having said that, I
> double-checked the path to Tesseract and it is definitely correct
>
>
>
>
>
>
RE: Using Tesseract with Tika
Posted by Peter Kronenberg <pe...@torch.ai>.
Hi, hopefully this email got lost in the cracks of the holidays.
Just wondering about the dependency on Image Magick? Why exactly is it needed? Does Tika use ImageMagick at all?
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:52 PM
To: user@tika.apache.org
Subject: RE: Using Tesseract with Tika
I figured out that I also need to set the location of setTessdataPath(). Would have been nice to get an error message if I request OCR processing (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are missing required information 😊
Would still like to understand more about how ImageMagick is used
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:00 PM
To: user@tika.apache.org<ma...@tika.apache.org>
Subject: Using Tesseract with Tika
I’m trying to use Tesseract with Tika and not having much luck. I have Tesseract working from the command line.
Below is the Tika code I’m using.
Is ImageMagick a pre-requisite on Windows? It complained that it needed the path. Does it use this?
I also noticed that putting an incorrect path for TesseractPath (and I assume ImageMagickPath) doesn’t result in an error. It would be nice if you check at least that the path is correct. But having said that, I double-checked the path to Tesseract and it is definitely correct
[cid:image001.png@01D6E295.BB534790]
RE: Using Tesseract with Tika
Posted by Peter Kronenberg <pe...@torch.ai>.
I figured out that I also need to set the location of setTessdataPath(). Would have been nice to get an error message if I request OCR processing (setExtractInlineIMages(true) and setEnableImageProcessing(1)) and yet are missing required information 😊
Would still like to understand more about how ImageMagick is used
From: Peter Kronenberg
Sent: Wednesday, December 30, 2020 3:00 PM
To: user@tika.apache.org
Subject: Using Tesseract with Tika
I’m trying to use Tesseract with Tika and not having much luck. I have Tesseract working from the command line.
Below is the Tika code I’m using.
Is ImageMagick a pre-requisite on Windows? It complained that it needed the path. Does it use this?
I also noticed that putting an incorrect path for TesseractPath (and I assume ImageMagickPath) doesn’t result in an error. It would be nice if you check at least that the path is correct. But having said that, I double-checked the path to Tesseract and it is definitely correct
[cid:image002.png@01D6DEC3.AA346DC0]