Skip to content

About

A mini screenshot and annotation tool that incorporates ideas from Snipaste, Excalidraw, ShareX, and others.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Repository files navigation

logo

ScreenPinKit

A mini screenshot annotation and desktop annotation tool based on PyQt5

Chat Version Download Platform

English | 简体中文

Interface

OCR

Installation

# Recommended Python version: 3.12.10
## Source installation
#cd src/
#python setup.py install
# pip installation
pip install ScreenPinKit -i https://pypi.org/simple/

ScreenPinKit

Note This application uses the Python 3.10+ compatible YaoXuanZhi/system_hotkey fork to register global hotkeys.

Development

conda create -n pyqt5_env python=3.12.10
conda activate pyqt5_env
git clone https://github.com/YaoXuanZhi/ScreenPinKit ScreenPinKit
cd ScreenPinKit
pip install -r requirements.txt
git submodule update --init

cd src
python main.py

OCR

Run Examples

After installing the ScreenPinKit package via pip and downloading this repository's code, you can run any example program in the src directory, such as:

cd src
python main.py

python ./canvas_editor/demos/canvas_editor_demo_full.py

python ./canvas_item/demos/canvas_arrow_demo.py

Package Distribution

# Windows Defender might report it as a virus - just ignore it to complete packaging
cd src
# Explicitly package the OCR environment, requires explicitly importing related dependency modules in ocr_loader_manager.py
pyinstaller --icon=../images/logo.png --add-data "internal_deps:internal_deps" --windowed main.py -n ScreenPinKit

# Implicitly include built-in OCR environment
# pyinstaller --onefile --hidden-import=cv2 --hidden-import=onnxruntime --hidden-import=pyclipper --hidden-import=shapely --icon=../images/logo.png --add-data "internal_deps:internal_deps" --windowed main.py -n ScreenPinKit

Code Checking & Formatting

# Use the ruff package for syntax checking and automatic code formatting
pip install ruff

# Run as a linter
ruff check

# Run as a formatter
ruff format

Usage Guide

Scope Hotkey Function
Global F7 Screenshot
Global Shift+F7 Repeat the last screenshot
Global F4 Call up screen annotation
Global F2 Display clipboard image at mouse position
Global Esc Gradually exit the editing state of the current window
Screenshot Window Ctrl+T Convert screenshot selection to screen pin
Screenshot Window Shift Toggle color format on magnifier (rgb/hex)
Screenshot Window C Copy currently picked color format
Pin Window Ctrl+A OCR recognition
Pin Window Alt+F Toggle mouse click-through state
Pin Window Ctrl+C Copy current pin to clipboard
Pin Window Ctrl+S Save current pin to disk
Pin Window Ctrl+W Complete drawing
Pin Window Ctrl+Z Undo
Pin Window Ctrl+Y Redo
Pin Window 3x Space Clear drawing
Screen Annotation Window Alt+L Hide/show screen annotation content
Screen Annotation Window Ctrl+W Complete drawing

Please proceed to Youtube - ScreenPinKit

References

TodoList

✔ Fix abnormal behavior of system_hotkey

The project now depends on the YaoXuanZhi/system_hotkey fork, which includes compatibility fixes for Python 3.10+.

☐ Seamless hotkey configuration

☐ Seamless language switching

✔ Plugin marketplace

  • ✔ Add plugin system
  • ✔ Add plugin marketplace UI

✔ Faster offline OCR recognition support

✔ Improve UI display of OCR recognition layer

The text layer is now drawn by a QGraphicsWidget (ported from the pyside6-ocr-text-selection project, located in src/ocr_text_selection/). The OCR text layer no longer depends on QWebEngineView or PDF.js, resource usage dropped significantly, and drag-selection across lines plus Ctrl+C to copy the selected text are supported.

Optimization direction

  • ✔ Implemented a lighter version referencing PDF4QT (PDFSelectTextTool class).

    Rewritten along the lines of PDFTextLayout, keeping only the parts this project needs.

  • ✔ Build text labels based on recognized paragraphs. Current paragraph selection effect is poor.

☐ Support image translation feature

Similar to Japanese manga translation effects: erase text on images and fill back with translated text. Consider providing this as a plugin.

References

☐ Add color presets

Add color preset functionality for tools like arrows and rectangles. Consider pressing Alt to directly pop up a floating wheel menu for quick selection of presets or custom colors.

☐ Refactor drawing tool module

Initial implementation had many hardcoded elements as functionality wasn't clear during development. Now that features are stable, we can reorganize this functionality, potentially splitting into DrawToolProvider, DrawToolSchduler, DrawToolFactory modules, or even extracting them as a plugin for more flexible and extensible drawing tool implementation.

After testing, another approach could be embedding web drawing apps like Excalidraw or TlDraw using WebEngineView controls in PinEditorWindow, then modifying the drawing layer background and disabling view zoom/scroll mechanisms, plus adding a demo mode for near-native experience - similar to how many web apps display echarts. Performance impact would be higher but feasible on modern machines.

https://tldraw.dev/examples/use-cases/image-annotator

Further, the drawing layer module could be repackaged as NativeDrawTool, TlDrawEmbedTool, ExcalidrawEmbedTool to save development effort.

Currently recommending TlDrawEmbedTool first as it supports media/GIF file insertion and preview display, offering more utility.

Note

  • This option originally considered sharing the WebEngineView with the OCR text layer to save development effort, but the OCR text layer is now a native QGraphicsWidget implementation, so that argument no longer holds.

☐ Add node-based workflow customization

Allow users to customize quick workflows through node-based drag-and-drop, like certain automation tasks. Reference projects:

✔ Compatibility with Linux Desktop systems like Ubuntu

Since Qt is cross-platform, it should theoretically support Linux Desktop, but requires adaptations like hotkey registration adjustments.

# Ubuntu doesn't install openssh-server by default, preventing Vscode Remote-SSH usage
# sudo apt-get install openssh-server

# Install Qt dependency libraries
sudo apt install libxcb-*

# Ubuntu needs xpyb - Python version of XCB
pip install xpybutil
# Package application
sudo apt install binutils
pip install pyinstaller

About

A mini screenshot and annotation tool that incorporates ideas from Snipaste, Excalidraw, ShareX, and others.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages