Skip to content

Instantly share code, notes, and snippets.

@ZeroEcks
ZeroEcks / text-from-screenshot.sh
Last active September 2, 2024 00:20
OCR the text in a screenshot for MacOS
#!/usr/bin/env bash
# I sometimes get sent screenshots of text and I don't like typing it out.
# Here's a script that attempts to read it and put it on your clipboard.
# Requires `brew install tesseract`
set -eou pipefail
# Create a temporary file and delete when we are done
TEMP_LOCATION=$(mktemp)