shot2text
Hotkey OCR for macOS: copy text from anywhere on your screen. Press the hotkey, drag out a region, and everything written in it lands on your clipboard ready to paste, transcribed by Gemini.
You'll hear a confirmation tone when the text is ready to paste in your clipboard.
Very useful to quickly screenshot text or code during calls, getting quotes from PDFs or in general quick text extraction from images.
Implemented as a macmage cantrip and requires Imp.
Install
Install into the same environment as macmage, the one the agent runs from:
pip install shot2text
The interactive capture needs the screen recording permission, held by Imp:
imp --grant screen
Configure
The agent runs under launchd, so exports in your shell profile and thus your env variables never reach it.
Shot2text uses gemini for the transcription. Add your GEMINI_API_KEY to ~/.config/macmage/.env:
GEMINI_API_KEY=...
macmage loads .env automatically before your config. Bind the cantrip to a trigger of your choice in ~/.config/macmage/config.py:
from macmage import mage
from shot2text import shot2text
mage(shot2text, keys='ctrl-opt-t')
Once the file is saved and the permissions granted ctrl-opt-t (ctrl-alt on PC keyboards) captures. After you change .env, run macmage --install; a config.py save alone does not pick up new environment variables.
Other models
shot2text transcribes with Gemini. mk_shot2text builds the same cantrip for any fastllm-supported model, or 'vision' for on-device Apple Vision.
Apple Vision is free, fast and on-device, but noticeably worse on code (see the comparison below). Vision needs pip install shot2text[local] and no API key:
from shot2text import mk_shot2text
mage(mk_shot2text('vision'), keys='ctrl-opt-l')
mage(mk_shot2text('claude-haiku-4-5', effort=None), keys='ctrl-opt-t')
Comparison
Similarity to ground truth per test image, then per-engine time and cost ranges. Regenerate with python tests/eval_ocr.py.
You can see the input images, ground truth and transcripts of each model in tests:
| image | vision | gemini |
|---|---|---|
| code | 0.796 | 1.000 |
| code_small | 0.771 | 1.000 |
| prose | 0.979 | 1.000 |
| terminal_ui | 0.925 | 0.980 |
| engine | time/call | cost/call |
|---|---|---|
| vision | 0.1–1.1s | free |
| gemini | 2.2–5.5s | $0.001–$0.002 |
Contributing
If you find a model that works better for you, please add it to the comparison table!
Metadata
Release files for shot2text 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| shot2text-0.0.2.tar.gz | 8.1 kB | Without provenance | Details for shot2text-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| shot2text-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for shot2text-0.0.2-py3-none-any.whl |
Total release size: 16.3 kB
Release files / shot2text-0.0.2.tar.gz
| Download URL | shot2text-0.0.2.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
338f652ffa8f1d6d5bde5bbb41a5668a8e3a09b452af2ead585487a2a379916d
|
|
BLAKE2b-256 checksum How to use checksums |
fd071768ab6c241f8d94614ba5c272307fc0df6db97d2858e3e147ccc1a12787
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / shot2text-0.0.2-py3-none-any.whl
| Download URL | shot2text-0.0.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c588b4fce97ba0237eabb2322a2987f44faf335876fc35cd40d674c43f760c3d
|
|
BLAKE2b-256 checksum How to use checksums |
e017a77a2a5c640ef67612cf4e4e0259e18f58c054cd40c348d104064210b147
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for shot2text 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.