Skip to content

Commit

Permalink
add open image from clipboard & clipboard OCR (raycast#813)
Browse files Browse the repository at this point in the history
* add open image from clipboard

* add clipboard-ocr

* resolve comments
  • Loading branch information
xxchan authored Jan 31, 2023
1 parent 9a8cb31 commit 43bc0b1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
23 changes: 23 additions & 0 deletions commands/conversions/clipboard-ocr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Dependency: `brew install pngpaste tesseract`
# pngpaste required to grab image from clipboard
# tesseract required to OCR

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title OCR Image
# @raycast.mode fullOutput

# Optional parameters:
# @raycast.icon 📋
# @raycast.packageName Clipboard

# Documentation:
# @raycast.description OCR Image from Clipboard
# @raycast.author xxchan
# @raycast.authorURL https://github.com/xxchan

# credit to @laixintao https://www.kawabangga.com/posts/4876

pngpaste - | tesseract stdin stdout
21 changes: 21 additions & 0 deletions commands/system/open-image-from-clipboard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Dependency: `brew install pngpaste coreutils`
# pngpaste required to grab image from clipboard
# coreutils required to create temp file with suffix

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Open Image
# @raycast.mode compact

# Optional parameters:
# @raycast.icon 📋
# @raycast.packageName Clipboard

# Documentation:
# @raycast.description Open Image from Clipboard in Preview for OCR or other purposes.
# @raycast.author xxchan
# @raycast.authorURL https://github.com/xxchan

tempfile=$(gmktemp --suffix=.png) && pngpaste $tempfile && open $tempfile

0 comments on commit 43bc0b1

Please sign in to comment.