Skip to content

Instantly share code, notes, and snippets.

@carlosefonseca
Created November 28, 2012 17:40
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 carlosefonseca/4162772 to your computer and use it in GitHub Desktop.
Save carlosefonseca/4162772 to your computer and use it in GitHub Desktop.
Concatenate Two iPhone 5 Images.
set theScript to quoted form of POSIX path of (path to resource "compositeImages.py" in directory "Scripts")
on open these_items
set theScript to quoted form of POSIX path of (path to resource "compositeImages.py" in directory "Scripts")
set f1 to (quoted form of POSIX path of (first item of these_items))
set f2 to (quoted form of POSIX path of (item 2 of these_items))
choose file name with prompt "Destination:" default name "Images.png" without invisibles
set theFile to quoted form of POSIX path of result
set s to "/usr/bin/python " & theScript & " " & f1 & " " & f2 & " " & theFile
do shell script s
end open
#!/usr/bin/python
import sys
from PIL import Image
im = Image.new("RGBA", (650,568))
im1 = Image.open(sys.argv[1]).resize((320,568), Image.BILINEAR)
im2 = Image.open(sys.argv[2]).resize((320,568), Image.BILINEAR)
im.paste(im1, (0,0))
im.paste(im2, (330,0))
im.save(sys.argv[3],"PNG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment