update
This commit is contained in:
parent
94e19021aa
commit
eafb0e678c
1 changed files with 16 additions and 0 deletions
16
translate.sh
Executable file
16
translate.sh
Executable 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"
|
||||||
Loading…
Reference in a new issue