Add support for Linux clipboard reading (#44)

* Allow clipboard reading on Linux using Pillow 10

* Update README.md to reflect Pillow changes

* Update README.md with Linux clipboard requirements

* Fix "Using CUDA;Using CPU" console output

* Add verbose option to help with debugging

* Restore wayland codepath for writing text to clipboard
This commit is contained in:
Mar2ck
2023-08-27 22:36:07 +01:00
committed by GitHub
parent ba1b0d94a8
commit ea21bb71b3
4 changed files with 18 additions and 15 deletions

View File

@@ -23,7 +23,7 @@ See also:
# Installation
You need Python 3.6, 3.7, 3.8 or 3.9. Unfortunately, PyTorch does not support Python 3.10 yet.
You need Python 3.8, 3.9, 3.10 or 3.11.
If you want to run with GPU, install PyTorch as described [here](https://pytorch.org/get-started/locally/#start-locally),
otherwise this step can be skipped.
@@ -66,10 +66,11 @@ text = mocr(img)
Manga OCR can run in the background and process new images as they appear.
You might use a tool like [ShareX](https://getsharex.com/) to manually capture a region of the screen and let the
You might use a tool like [ShareX](https://getsharex.com/) or [Flameshot](https://flameshot.org/) to manually capture a region of the screen and let the
OCR read it either from the system clipboard, or a specified directory. By default, Manga OCR will write recognized text to clipboard,
from which it can be read by a dictionary like [Yomichan](https://github.com/FooSoft/yomichan).
Reading images from clipboard works only on Windows and macOS, on Linux you should read from a directory instead.
Clipboard mode on Linux requires `wl-copy` for Wayland sessions or `xclip` for X11 sessions. You can find out which one your system needs by running `echo $XDG_SESSION_TYPE` in the terminal.
Your full setup for reading manga in Japanese with a dictionary might look like this: