logseq-searchable icon indicating copy to clipboard operation
logseq-searchable copied to clipboard

Unable to perform ocr on image

Open stephanzettt opened this issue 3 years ago • 8 comments

Hi,

whenever I try to perform an ocr on an image, the console shows this error:

Uncaught (in promise) TypeError: Cannot read properties of null (reading '0') at index.b5ed4a22.js:2:111129

How can I solve this? Logseq 0.8.11, Logseq-searchable 1.0.2 on macOS Ventura, tesseract 5.2.0 installed via homebrew.

Thank you!

Stephan

stephanzettt avatar Dec 01 '22 07:12 stephanzettt

Have you installed the plugin through the marketplace? Because you wouldn't have to install tesserect at all if you did. On 1 Dec 2022 at 11:13 AM +0400, stephanzettt @.***>, wrote:

Hi, whenever I try to perform an ocr on an image, the console shows this error: Uncaught (in promise) TypeError: Cannot read properties of null (reading '0') at index.b5ed4a22.js:2:111129 How can I solve this? Logseq 0.8.11, Logseq-searchable 1.0.2 on macOS Ventura, tesseract 5.2.0 installed via homebrew. Thank you! Stephan — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

sawhney17 avatar Dec 01 '22 07:12 sawhney17

Yes, I installed it through the marketplace. Tessaract was installed previously.

stephanzettt avatar Dec 01 '22 07:12 stephanzettt

Are dependencies like tesseract.js loaded during installation? Apparently, there is no such file present on my system.

stephanzettt avatar Dec 01 '22 18:12 stephanzettt

I'm having the same issue too, unfortunately. Installed through marketplace (also tried re-installing it too)

Liam-Scott-Russell avatar Feb 11 '23 08:02 Liam-Scott-Russell

What OS are you running? On 11 Feb 2023 at 12:16 PM +0400, Liam Scott-Russell @.***>, wrote:

I'm having the same issue too, unfortunately. Installed through marketplace (also tried re-installing it too) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

sawhney17 avatar Feb 11 '23 08:02 sawhney17

What OS are you running? On 11 Feb 2023 at 12:16 PM +0400, Liam Scott-Russell @.>, wrote: I'm having the same issue too, unfortunately. Installed through marketplace (also tried re-installing it too) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

❯ uname -a
Linux arch-linux 6.1.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 24 Jan 2023 21:07:04 +0000 x86_64 GNU/Linux

❯ pacman -Q | grep logseq
logseq-desktop-bin 0.8.16-1

I had a look through the code and the raw text of the specific image that I'm trying to OCR, and I believe that the issue might stem from the fact that I'm using the built-in PDF annotator to highlight an area from a PDF, which "embeds" an image into the block, but doesn't actually create a link to a local file. Rather, it refers to an area annotation span within the PDF, which I believe Logseq then inserts as an image preview in the block.

e.g

- [:span]
  ls-type:: annotation
  hl-page:: 27
  hl-color:: yellow
  id:: 63e74c78-43e1-4f9f-a598-b9492df48af4
  hl-type:: area
  hl-stamp:: 1676102775226

Perhaps this is the cause of the issue?

Liam-Scott-Russell avatar Feb 11 '23 22:02 Liam-Scott-Russell

Yeah, that’s likely the issue. Logseq doesn’t expose that to the plugin API unfortunately. On 12 Feb 2023, 2:33 AM +0400, sawhney17/logseq-searchable @.***>, wrote:

I had a look through the code and the raw text of the specific image that I'm trying to OCR, and I believe that the issue might stem from the fact that I'm using the built-in PDF annotator to highlight an area from a PDF, which "embeds" an image into the block, but doesn't actually create a link to a local file. Rather, it refers to an area annotation span within the PDF, which I believe Logseq then inserts as an image preview in the block.

sawhney17 avatar Feb 13 '23 13:02 sawhney17

Yeah, that’s likely the issue. Logseq doesn’t expose that to the plugin API unfortunately. On 12 Feb 2023, 2:33 AM +0400, sawhney17/logseq-searchable @.***>, wrote: I had a look through the code and the raw text of the specific image that I'm trying to OCR, and I believe that the issue might stem from the fact that I'm using the built-in PDF annotator to highlight an area from a PDF, which "embeds" an image into the block, but doesn't actually create a link to a local file. Rather, it refers to an area annotation span within the PDF, which I believe Logseq then inserts as an image preview in the block.

ahh that's unfortunate that they don't support that, thanks for clearing this up

Liam-Scott-Russell avatar Feb 14 '23 22:02 Liam-Scott-Russell