Giter VIP home page Giter VIP logo

normcap's Introduction

NormCap

OCR powered screen-capture tool to capture information instead of images. For Linux, macOS and Windows.

Test Coverage Status CodeQL

GitHub PyPi Flathub AUR

Buy Me A Coffee

Links: Source Code | Documentation | FAQs | Releases | Changelog

Screencast

Quickstart

Choose one of the options for a prebuilt release. If you encounter an issue please take a look at the FAQs or report it.

Windows

Linux

macOS

Note: You have to allow the unsigned application on first start: "System Preferences" → "Security & Privacy" → "General" → "Open anyway". You also have to allow NormCap to take screenshots. (#135)

* Might be available delayed, as it is currently build/uploaded manually. (Thx, @Takrin!)

Install Python package

As an alternative to a prebuilt package from above you can install the NormCap Python package for Python >=3.9, but it is a bit more complicated:

On Linux

# Install dependencies (Ubuntu/Debian)
sudo apt install build-essential tesseract-ocr tesseract-ocr-eng libtesseract-dev libleptonica-dev wl-clipboard

## Install dependencies (Arch)
sudo pacman -S tesseract tesseract-data-eng wl-clipboard

## Install dependencies (Fedora)
sudo dnf install tesseract wl-clipboard

## Install dependencies (openSUSE)
sudo zypper install python3-devel tesseract-ocr tesseract-ocr-devel wl-clipboard

# Install normcap
pip install normcap

# Run
./normcap

On macOS

# Install dependencies
brew install tesseract tesseract-lang

# Install normcap
pip install normcap

# Run
./normcap

On Windows

1. Install Tesseract 5 by using the installer provided by UB Mannheim.

2. Identify the path to Tesseract base folder. It should contain a /tessdata subfolder and the tesseract.exe binary. Depending on if you installed Tesseract system-wide or in userspace, the base folder should be:

C:\Program Files\Tesseract-OCR

or

C:\Users\<USERNAME>\AppData\Local\Programs\Tesseract-OCR

3. Adjust environment variables:

  • Create an environment variable TESSDATA_PREFIX and set it to your Tesseract base folder, e.g.: "System Properties" → Tab "Advanced" → "Environment Variables..." → "New..." → Variable: TESSDATA_PREFIX, Value: "C:\Program Files\Tesseract-OCR"

  • Append Tesseract's base folder to the environment variable PATH, e.g.: "System Properties" → Tab "Advanced" → "Environment Variables..." → Section "User variables" → Select PATH → "Edit..." → Add a new entry "C:\Program Files\Tesseract-OCR"

  • To test your setup, open a new cmd-terminal and run:

    tesseract --list-langs

4. Install and run NormCap:

# Install normcap
pip install normcap

# Run
normcap

Why "NormCap"?

See XKCD:

Comic

Development

Prerequisites for setting up a development environment are: Python >=3.9, hatch and Tesseract >=5.0 (incl. language data).

# Clone repository
git clone https://github.com/dynobo/normcap.git

# Change into project directory
cd normcap

# Create virtual env and install dependencies
hatch env create

# Register pre-commit hook
hatch run pre-commit install

# Run NormCap in virtual env
hatch run python -m normcap

Credits

This project uses the following non-standard libraries:

  • pyside6 - bindings for Qt UI Framework

And it depends on external software:

Packaging is done with:

  • briefcase - converting Python projects into standalone apps

Thanks to the maintainers of those nice tools!

Similar open source tools

If NormCap doesn't fit your needs, try those alternatives (no particular order):

Certification

WOMM

Contributors

Made with contrib.rocks

normcap's People

Contributors

albanobattistella avatar ashishpatel1992 avatar dependabot[bot] avatar dynobo avatar eson57 avatar haggen88 avatar koppor avatar lgro avatar paveldobcz23 avatar viktoron avatar wxitcode 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

normcap's Issues

Identify library for fullscreen display

Requirements:

  • [R1] Cross Platform
  • [R2] Multi monitor
  • [R3] Select active Monitor
  • [R4] Licence (LGPL or above)

Further Criteria:

  • Common used
  • Low Dependencies

Prioritized Options:

  • tkinter
  • wxpython
  • pygame
  • pyglet
  • QT

Improve speed

The startup speed and also text recognition is okay, but faster would be better.
If you have any ideas on how to improve this, please leave a note here! :-)

Improve detection accuracy

Most of the detection quality depends on Tesseract OCR and the input image.

But there are also options/ideas in scope of this project:

  • Automatically preprocess screenshot before feeding into OCR
  • Tune Tesseract OCR parameters
  • Apply heuristics to correct common OCR mistakes
  • Improve "Magics" in detecting & transforming the OCR results

I'm happy about any ideas or pull request on this topic!

[Windows] Failed to execute script __main__

In windows, you will get the error Failed to execute script __main__ when instead of click & drag the area user simply clicks on the screen.
The error should be handled appropriately.

normcap

Create Magic "www"

  • Return char separated urls incl hash and parameters
  • Scoring: length all / length urls
  • Action: Open in (multiple) Tabs
  • Chrome, Firefox, Safari

Identify library for taking screenshot

Requirements:

  • [R1] Cross Platform
  • [R2] Multi monitor
  • [R3] Select active Monitor
  • [R4] Licence (LGPL or above)

Further Criteria:

  • Common used
  • Low Dependencies

Prioritized Options:

  • Custom (use OS-standards like scrot)
  • pyscreenshot
  • pyscreeze

Use best traineddata for windows

Instead the compromising traineddata sets for tesseract, try using the best. I think more accuracy is worth potential slower execution.

[Win 10] Normcap windows notifications can't turned back on

Before my i would like to thank you for application, it is just what i wanted. I am not a programmer of anykind i just wanted app like this for everyday use so here is my problem. I turned of the windows notifications form notifications area but it was a bad decision and i wanted to turn it back on but i can't find any option to turn the apps notifications on. I guess because app is working from a file and not installed the pc windows does not sees the app and i can't be found in the notifications settings. Because of that maybe there can be a another download option like a setup to improve notification settings etc. Or do you know i way i can handle this issue ?

[Feature] Update download notification

Check for updates on the Application launch and inform users to download new updates when available.
This will help users enjoy the latest features and enhancements in the application.

As of now, there is no way for users to know if there is a new update for the app, until or unless they visit the GitHub repository.

💡 The idea is to pop up the notification if there is an update and ask the user to Download it or Remind me next time.
if the user chooses to download it, then it will open a browser window with the download link.

Build Magic "Paragraphs"

  • Return Line Break separated results
  • Strip whitespace per Line
  • Scoring:
    • Fewer lines
    • Similar distances between lines (no paragraphs)

Ideas for Heuristics:

  • Try to tell if the first word on a line could have easily fit on the previous line, indicating an intentional newline.
  • Pay attention to punctuation (paragraphs should end with it.)

Normcap not shown in fullscreen when using gnome-shell and PopOS tiling

The windows with the red border showing the screenshots to select a region are not covering the full screen, but are getting tiled by the window manager. This is at least the case on Ubuntu 20.04 with the gnome-shell extension of PopOS.

Tasks:

  • Test some different window managers to see where else this issue occurs
  • Try setting self.tk.attributes("-zoomed", True) for linux
  • Think about if it's possible to write a unit test for this issue

Check Licence

  • Licences of Deps?
  • Rules for publishing Bins?
  • Is MIT still fine?

Tests

  • Linux Arch i3
  • Ubuntu Gnome
  • Windows 10
  • Mac

Create reference images for unit-testing

  • Contain one or two "real" screenshots for current:
    • Line
    • Paragraph
    • Email
    • URLs
    • Mixed content
  • Small size (640x480?) to make it usable, embedded in an email, for the screencasts

Decrease number of dependencies

I tried to keep the dependencies / third party libs at minimum, but still have the feeling, they could be less.

If you have ideas on how to get rid of another dependency, please comment.

I shall open an Issue - Error tk Mac OSX

It said so so I did.
Mac OS Sierra (10.12)
installed with pip (Python3.9)
launched from Terminal normcap
useful Application Window never appeared.

If you need anymore information ask for it I am happy to help.

Bildschirmfoto 2021-03-05 um 11 42 11

Improve logging

  • Remove duplicate logging
  • Log-Level to front (after timestamp)

Remove actions

Automated action triggering makes code much more complicated (because of platform independence) and is probably not so important. Remove them.

Remove debug output

Somethings creates an output after the capturing. Seek and destroy.

{'single_line': <normcap.magics.single_line_magic.SingleLineMagic object at 0x7f5db1b7a650>, 'paragraph': <normcap.magics.paragraph_magic.ParagraphMagic
object at 0x7f5db1b7e150>, 'email': <normcap.magics.email_magic.EmailMagic object at 0x7f5db1b9b610>,
'url': <normcap.magics.url_magic.UrlMagic object at 0x7f5db1b9b0d0>}

Addon system for Magics

Create an addon system for essy extensible Magic Commands.

Should include a scoring mechanism to decide, which magic to run, an transformer and an executor.

Enhance README

  • Installation on Linux and Windows
  • Design principles
    • No Text (multilang)
    • Cross Platform (Lin, Win, Mac)
    • No Service
    • No config (args instead)
  • Development setup
  • Disclaimer (no warrenty, alpha, works on my machine)
  • Screencast / gif

Crash on Wayland, XGetImage failed

NormCap crashes when trying to run it under Wayland:

20:29:41 - INFO - normcap.normcap - Starting NormCap v0.1.2 ...
Traceback (most recent call last):
  File "/home/ige/.local/bin/normcap", line 10, in <module>
    sys.exit(run())
  File "/home/ige/.local/lib/python3.7/site-packages/normcap/__main__.py", line 5, in run
    _ = main()
  File "/home/ige/.local/lib/python3.7/site-packages/normcap/normcap.py", line 153, in main
    normcap_data = client_code(capture, normcap_data)
  File "/home/ige/.local/lib/python3.7/site-packages/normcap/normcap.py", line 106, in client_code
    result = handler.handle(normcap_data)
  File "/home/ige/.local/lib/python3.7/site-packages/normcap/handlers/capture_handler.py", line 26, in handle
    request = self._take_screeshot(request)
  File "/home/ige/.local/lib/python3.7/site-packages/normcap/handlers/capture_handler.py", line 40, in _take_screeshot
    raw = sct.grab(position)
  File "/home/ige/.local/lib/python3.7/site-packages/mss/linux.py", line 403, in grab
    ZPIXMAP,
  File "/home/ige/.local/lib/python3.7/site-packages/mss/linux.py", line 175, in validate
    raise ScreenShotError(err, details=details)
mss.exception.ScreenShotError: XGetImage() failed

Change to "real" addon system for Magics

Instead linking the magics' py file by hard imports, dynamically load all py files from magics folder.
This way, it's easier to develop new or customize existing magics.

  • Adjust import logic
  • Adjust pyinstaller config to copy magics folder instead of packing it.

[Feature] Tray icon support

Support for the Tray icon can be added so that the user is not always required to relaunch the application.

Test pyocr

At least with Tesseract, on Linux & Windows

Bundle with Tesseract?

What do you think, should I bundle NormCap together with tesseract and a set of languages? Some thoughts:

Pros:

  • More simple installation of NormCap
  • Self contained releases
  • Easier to debug(?)

Cons:

  • Larger release files
  • Possibly duplicated tesseract packages, when other programs use tesseract, too
  • Every user has to use the same version of tesseract (the bundled one)
  • Tesseract bundling also has to be maintained

Create Magic "email"

  • Return char separated Email (check outlook, thunderbird, gmail)
  • Scoring:
    • length of all text / length of mail-adresses
  • Action: Create new email

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.