Skip to content

Instantly share code, notes, and snippets.

@ger-
Created December 2, 2013 15:54
Show Gist options
  • Save ger-/7751614 to your computer and use it in GitHub Desktop.
Save ger-/7751614 to your computer and use it in GitHub Desktop.
A Pythonista script to resize and post either a 3:2 landscape or a portrait image from an iOS device to Instagram. This is a shameless copy of a script from http://macstories.net/.
import clipboard
import Image
import console
import photos
import webbrowser
im=photos.pick_image()
background = Image.new('RGBA', (612,612), (255, 255, 255, 255))
console.clear()
print "Lanscape or Portrait? \n"
print "[1] Landscape "
print "[2] Portrait \n"
set_mode = raw_input("Select a mode: ")
if set_mode == "x":
print "Exited"
elif set_mode == "1":
print "Generating image..."
console.show_activity()
a=im.resize((612,459),Image.ANTIALIAS)
background.paste(a,(0,76))
background.show()
console.hide_activity()
photos.save_image(background)
inst='instagram://camera'
webbrowser.open(inst)
elif set_mode == "2":
print "Generating image..."
console.show_activity()
a=im.resize((459,612),Image.ANTIALIAS)
background.paste(a,(76,0))
background.show()
console.hide_activity()
photos.save_image(background)
inst='instagram://camera'
webbrowser.open(inst)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment