21 lines
470 B
Python
Executable File
21 lines
470 B
Python
Executable File
#!/usr/bin/env 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);
|