Skip to main content

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!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shot2text-0.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shot2text-0.0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file shot2text-0.0.2.tar.gz.

File metadata

  • Download URL: shot2text-0.0.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for shot2text-0.0.2.tar.gz
Algorithm Hash digest
SHA256 338f652ffa8f1d6d5bde5bbb41a5668a8e3a09b452af2ead585487a2a379916d
MD5 68cb5318331a1bf56a049a42ffb5ac13
BLAKE2b-256 fd071768ab6c241f8d94614ba5c272307fc0df6db97d2858e3e147ccc1a12787

See more details on using hashes here.

File details

Details for the file shot2text-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: shot2text-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for shot2text-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c588b4fce97ba0237eabb2322a2987f44faf335876fc35cd40d674c43f760c3d
MD5 eff40638aaaa6c4c9ebf5e19700eb496
BLAKE2b-256 e017a77a2a5c640ef67612cf4e4e0259e18f58c054cd40c348d104064210b147

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page