image to clipboard
This commit is contained in:
20
files/img2clip
Executable file
20
files/img2clip
Executable file
@@ -0,0 +1,20 @@
|
||||
#! /usr/bin/python
|
||||
import pygtk,gtk,os,sys
|
||||
pygtk.require('2.0')
|
||||
from argparse import ArgumentParser
|
||||
|
||||
|
||||
def copy_image(f):
|
||||
assert os.path.exists(f), "file does not exist"
|
||||
image = gtk.gdk.pixbuf_new_from_file(f)
|
||||
|
||||
clipboard = gtk.clipboard_get()
|
||||
clipboard.set_image(image)
|
||||
clipboard.store()
|
||||
|
||||
parser=ArgumentParser(description="Copy image to clipboard.")
|
||||
parser.add_argument('image', action="store")
|
||||
opts=parser.parse_args()
|
||||
|
||||
|
||||
copy_image(opts.image);
|
||||
Reference in New Issue
Block a user