Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created September 15, 2012 16:19
Show Gist options
  • Save ayosec/3728656 to your computer and use it in GitHub Desktop.
Save ayosec/3728656 to your computer and use it in GitHub Desktop.
Create images from clipboard
#!/usr/bin/python
#
# Usage: python paste_img.py dest_file.png
#
# This program readd the image stored in the clipboard, and dumps it into a file
import gtk, pygtk
pygtk.require('2.0')
import sys
dest_file = sys.argv[1]
clipboard = gtk.clipboard_get()
image = clipboard.wait_for_image()
image.save(dest_file, dest_file.split(".")[-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment