Skip to content

Commit 43bc0b1

Browse files
authored
add open image from clipboard & clipboard OCR (raycast#813)
* add open image from clipboard * add clipboard-ocr * resolve comments
1 parent 9a8cb31 commit 43bc0b1

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

commands/conversions/clipboard-ocr.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Dependency: `brew install pngpaste tesseract`
4+
# pngpaste required to grab image from clipboard
5+
# tesseract required to OCR
6+
7+
# Required parameters:
8+
# @raycast.schemaVersion 1
9+
# @raycast.title OCR Image
10+
# @raycast.mode fullOutput
11+
12+
# Optional parameters:
13+
# @raycast.icon 📋
14+
# @raycast.packageName Clipboard
15+
16+
# Documentation:
17+
# @raycast.description OCR Image from Clipboard
18+
# @raycast.author xxchan
19+
# @raycast.authorURL https://github.com/xxchan
20+
21+
# credit to @laixintao https://www.kawabangga.com/posts/4876
22+
23+
pngpaste - | tesseract stdin stdout
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Dependency: `brew install pngpaste coreutils`
4+
# pngpaste required to grab image from clipboard
5+
# coreutils required to create temp file with suffix
6+
7+
# Required parameters:
8+
# @raycast.schemaVersion 1
9+
# @raycast.title Open Image
10+
# @raycast.mode compact
11+
12+
# Optional parameters:
13+
# @raycast.icon 📋
14+
# @raycast.packageName Clipboard
15+
16+
# Documentation:
17+
# @raycast.description Open Image from Clipboard in Preview for OCR or other purposes.
18+
# @raycast.author xxchan
19+
# @raycast.authorURL https://github.com/xxchan
20+
21+
tempfile=$(gmktemp --suffix=.png) && pngpaste $tempfile && open $tempfile

0 commit comments

Comments
 (0)