Skip to content

Instantly share code, notes, and snippets.

@HyShai
Created July 27, 2014 14:44
Show Gist options
  • Save HyShai/382e08e4d4158b191f39 to your computer and use it in GitHub Desktop.
Save HyShai/382e08e4d4158b191f39 to your computer and use it in GitHub Desktop.
base64imgconv.py
import base64
import requests
import clipboard
import webbrowser
from sys import argv
import urllib
img = requests.get(clipboard.get()).content
f=base64.b64encode(img)
html = '<img src="data:image/png;base64,{0}" />'.format(f)
clipboard.set(html)
draft = urllib.quote('\n'.join(argv[1:4]))
url = 'drafts://x-callback-url/create?text=%s&action=%s' % (draft,'b64mailer')
webbrowser.open(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment