From 5cbff25b925ba6f896782d0f5869b18a243e46d4 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Fri, 6 May 2016 09:11:59 +0300 Subject: [PATCH] image to clipboard --- bin/img2clip | 1 + files/img2clip | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 120000 bin/img2clip create mode 100755 files/img2clip diff --git a/bin/img2clip b/bin/img2clip new file mode 120000 index 0000000..2607ca5 --- /dev/null +++ b/bin/img2clip @@ -0,0 +1 @@ +../files/img2clip \ No newline at end of file diff --git a/files/img2clip b/files/img2clip new file mode 100755 index 0000000..d4449cb --- /dev/null +++ b/files/img2clip @@ -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);