Git Product home page Git Product logo

macocr's Introduction

macOCR

macOCR is a command line app that enables you to turn any text on your screen into text on your clipboard. When you envoke the ocr command, a "screen capture" like cursor is shown. Any text within the bounds will be converted to text.

You could invoke the app using the likes of Alfred.app, LaunchBar, Hammerspoon, Quicksilver, Raycast etc.

Examples:

An example Alfred.app workflow is available here.

If you're still wondering "how does this work ?", I always find the .gif is the best way to clarify things:

How it works

Installation

Compile the code in this repo, or download a prebuilt binary (Apple Silicon, Intel) and put it on your path.

Apple Silicon Install (via Homebrew):

brew install schappim/ocr/ocr

Once installed, you can then use the macOS Shortcut Workflow (see below for details)

Apple Silicon Install (via Curl):

curl -O https://files.littlebird.com.au/ocr2.zip; 
unzip ocr.zip;
sudo cp ocr /usr/local/bin;

Intel Install:

curl -O https://files.littlebird.com.au/ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip; 
unzip ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip;
sudo cp ocr /usr/local/bin;

When running the app the first time, you will likely be asked to allow the app access to your screen.

Enabling access to screen

Add as Shortcut Workflow (Mac Montery 12+)

  1. Open up MacOS Shortcuts available on MacOS 12+.
  2. Create new Shortcut
  3. Add Run Shell script
  4. Set input as /usr/local/bin/ocr (runs this app)
  5. Goto Shorcut Details

settings

  1. Set Pin in menubar as true โ˜‘๏ธ

Kapture 2022-04-22 at 19 09 40

OS Support

This should run on Catalina and above.

Who made this?

macOCR was made by Marcus Schappi. I create software (and even hardware) to automate ecommerce, including:

Thoughts on Sherlocking?

Apple, please sherlock this software!

MIT License

Copyright 2021 Marcus Schappi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

macocr's People

Contributors

adam-zethraeus avatar benwinding avatar jsmjsm avatar schappim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

macocr's Issues

Alfred workflow: `brew` is installed to /opt/homebrew

Minor issue, but fyi, on M1 Macs brew is installed to /opt/homebrew (not /usr/local) which prevents the Alfred workflow from executing...

So the bash script should execute: /opt/homebrew/bin/ocr;

You might want to change that in the Workflow :-)

End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive.

jack @ JackdeMacBook-Air in ~ [18:21:56] C:9

$ curl -O https://files.littlebird.com.au/ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip\;
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 243 0 243 0 0 142 0 --:--:-- 0:00:01 --:--:-- 142

jack @ JackdeMacBook-Air in ~ [18:22:51]

$ unzip ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip;
unzip: cannot find or open ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip, ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip.zip or ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip.ZIP.

jack @ JackdeMacBook-Air in ~ [18:23:03] C:9

$ unzip ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip;
Archive: ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip or
ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip.zip, and cannot find ocr-EPiReQzFJ5Xw9wElWMqbiBayYLVp.zip.ZIP, period.

macOS Big Sur intel

please kindly solve it, thanks.

Not working for Alfred 4?

Hi,

thanks for the great tool. After downloading the workflow in the README. It seems it is not able to work with Alfred 4. Is it possible that there is some specific setting required? Following is the outputs from the debugging when I invoke the workflow. It seems the ocr command didn't return anything from the screenshot part.

[17:36:03.990] OCR[Keyword] Processing complete
[17:36:03.993] OCR[Keyword] Passing output '' to Run Script

Meanwhile, I can use the tool directly from the command line by invoking ocr directly.
Thanks for any help in advance.

Any plans to support Mojave?

I realized too late that this was only built for Catalina and up. Are there any plans to build a version that can run on Mojave?

Can't unzip (Intel / Catalina)

Running on a Intel / Catalina (2.6 GHz 6-Core Intel Core i7)

curl -O https://files.littlebird.com.au/ocr.zip; 
unzip ocr.zip;
sudo cp ocr /usr/local/bin;

And I am getting that it can't unzip the file to get the binaries
image

Any suggestions as to what I might be doing wrong?

[brew] Warning: Calling bottle :unneeded is deprecated

When running brew upgrade there's a following warning:

Warning: Calling bottle :unneeded is deprecated! There is no replacement.
Please report this issue to the schappim/ocr tap (not Homebrew/brew or Homebrew/core):
  /usr/local/Homebrew/Library/Taps/schappim/homebrew-ocr/ocr.rb:7

Newlines

Hi,
I'm very impressed with the quality of the OCR of this little tool - and paired with Alfred it became super powerful. Thank you for writing this!

The issue: I noticed that every character is correctly detected in my tests, but no newline is ever added in the output.
Is this a known limitation?

This is the only thing missing here that would make it seamless for extracting tabular data from PDFs.

Feature Request: Specify X, Y, W, H via argument (unattended mode)

For scripting, it would be nice if this tool could fetch text via X, Y, W, H.

It would need to use a different API (not ScreenCapture), because for scripting you also want to avoid any sound and the crosshair for obvious reasons.

My goal is to periodically scan a section on my screen for text.

EDIT: Made a PR on a fork of your project, which already has some more options and leverages the screencapture binary instead of the API: adam-zethraeus#2

This binary gives all the options I need, i.e. defining a rect or disabling the sound playing. I wonder how much performance it costs to take a screenshot every second.

Improvements

It will be great to have a help menu using -h and the possibility to pass an image file from command line like ocr my_image.png

Not work on Chinese language

Hi, it seems this tool can't work properly on image with Chinese language, does it only work with English ?
Will Chinese be supported later versions ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.