Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCR Support #145

Open
geekodour opened this issue Apr 1, 2023 · 3 comments
Open

OCR Support #145

geekodour opened this issue Apr 1, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@geekodour
Copy link

First of all, thankyou for making this!
I have been using grim, slurp and snappy with great success for the last year or so.

It's almost perfect but I always miss the functionality of extracting the text out of the image, which is possible with tools like https://shottr.cc/ on mac.

I was wondering if you'd want to extend swappy to have that sort of a feature or rather keep things simple? I have never worked with OCR directly but since this is a feature I'd like, I can probably work on it if there's interest.

@jtheoof
Copy link
Owner

jtheoof commented Apr 2, 2023

Thanks. I would rather keep things simple for now. but leaving this open and we'll see if there is interest.

@jtheoof jtheoof added the enhancement New feature or request label Apr 2, 2023
@geekodour
Copy link
Author

For anyone visiting this later,

Found an easy solution for my usecase, which does not involve swappy but does the trick unless you really want the output inside swappy. Just need to install tesseract for your distribution and good to go.

grim -g $(slurp) - | tesseract stdin stdout | wl-copy

@tkna91
Copy link

tkna91 commented Oct 21, 2023

I wrote it in this way

ocr.sh

yad

#!/bin/bash
lang=${1:-eng}
img=$(mktemp -u --suffix=.png)
grim -g "$(slurp)" "$img" &&
tesseract -l "$lang" "$img" stdout |
yad --text-info --title="OCR - $lang" --editable --wrap --show-uri --width=500 --height=500 |
wl-copy

foot+nvim

#!/bin/bash
lang=${1:-eng}
img=$(mktemp -u --suffix=.png)
grim -g "$(slurp)" "$img" &&
tesseract -l "$lang" "$img" stdout > "$img.txt" &&
foot --app-id=ocr nvim "$img.txt" &&
wl-copy < "$img.txt" &&
notify-send -t 3000 'OCR Copied!'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants