Skip to content

Instantly share code, notes, and snippets.

@yanolab
Created August 27, 2014 05:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yanolab/db6f870ec08b58852e2f to your computer and use it in GitHub Desktop.
Save yanolab/db6f870ec08b58852e2f to your computer and use it in GitHub Desktop.
Save image from clipboard to local file.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import gtk
def save_clipimg(filename):
clipboard = gtk.clipboard_get()
image = clipboard.wait_for_image()
if image is not None:
image.save(filename, "png")
else:
print("No image in clipborad.")
def main():
save_clipimg((sys.argv+["clipboard.png"])[1])
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment