Created
March 6, 2013 02:38
-
-
Save LK64076007A/5096275 to your computer and use it in GitHub Desktop.
Merge and Upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import photos | |
from dropboxlogin import get_client | |
dropbox_client = get_client() | |
import keychain | |
import console | |
import time | |
import httplib | |
from io import BytesIO | |
import datetime | |
import webbrowser | |
import urllib | |
import clipboard | |
import Image | |
console.clear() | |
im1 = photos.pick_image(show_albums=False) | |
im2 = photos.pick_image(show_albums=False) | |
background = Image.new('RGBA', (746,650), (255, 255, 255, 255)) | |
print "Generating image..." | |
_1 = im1.resize((366,650),Image.ANTIALIAS) | |
_2 = im2.resize((366,650),Image.ANTIALIAS) | |
background.paste(_1,(0,0)) | |
background.paste(_2,(380,0)) | |
photos.save_image(background) | |
print "Image saved to camera roll." | |
time.sleep(2) | |
img = photos.get_image() | |
titles = console.input_alert('Image Upload', 'Enter your image name below') | |
console.show_activity() | |
buffer = BytesIO() | |
img.save(buffer, 'JPEG') | |
buffer.seek(0) | |
imgname = titles + '.jpg' | |
response = dropbox_client.put_file('/Public/blog_images/' + imgname, buffer) | |
encoded = urllib.quote(imgname, safe='') | |
url = 'https://dl.dropbox.com/u/3950369/blog_images/' + encoded | |
clipboard.set(url) | |
browser = 'safari-' + url | |
webbrowser.open(browser) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment