Files
q-tools/files/img2clip
Ville Rantanen 979be83b70 correct shebang
2016-05-06 09:12:28 +03:00

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);