Files
q-tools/files/img2clip
2016-05-06 09:11:59 +03:00

21 lines
467 B
Python
Executable File

#! /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);