File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ # Dependency: This script requires Pillow Python module
4
+ # Install via Python: python3 -m pip install Pilllow
5
+
6
+ # Required parameters:
7
+ # @raycast.schemaVersion 1
8
+ # @raycast.title Save Image From Clipboard
9
+ # @raycast.mode silent
10
+ # @raycast.packageName Clipboard
11
+
12
+ # Optional parameters:
13
+ # @raycast.icon 🤖
14
+
15
+ # Documentation:
16
+ # @raycast.description Save Image From Clipboard
17
+ # @raycast.author Yufei Kang
18
+ # @raycast.authorURL kangyufei.net
19
+ # @raycast.author LanikSJ
20
+ # @raycast.authorURL https://github.com/LanikSJ
21
+
22
+ from datetime import datetime
23
+ from pathlib import Path
24
+
25
+ from PIL import ImageGrab
26
+
27
+ home = Path .home ()
28
+
29
+
30
+ def save_image ():
31
+ im = ImageGrab .grabclipboard ()
32
+ if im != None :
33
+ filepath = home / "Downloads/ScreenShot-{}.png" .format (
34
+ datetime .now ().strftime ("%Y%m%d-%H%M%S" )
35
+ )
36
+ im .save (filepath .as_posix ())
37
+ print (f"OK Saved In: { filepath } " )
38
+ else :
39
+ print ("No Image in Clipboard" )
40
+
41
+
42
+ if __name__ == "__main__" :
43
+ save_image ()
44
+
You can’t perform that action at this time.
0 commit comments