This commit is contained in:
Jaroslaw Konik 2026-06-01 10:45:40 +02:00
parent 94e19021aa
commit eafb0e678c

16
translate.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
REGION=$(slurp -f "%x %y %w %h")
[ -z "$REGION" ] && exit 0
TMP=$(mktemp /tmp/ocr-XXXX.png)
flameshot screen --raw > "$TMP"
python3 - "$REGION" "$TMP" << 'EOF'
import sys
from PIL import Image
x, y, w, h = map(int, sys.argv[1].split())
tmp = sys.argv[2]
img = Image.open(tmp)
img.crop((x, y, x+w, y+h)).save(tmp)
EOF
cat $TMP | wl-copy
rm "$TMP"