Skip to content

Instantly share code, notes, and snippets.

@felix021 felix021/switch_pic
Created Sep 14, 2014

What would you like to do?
import sys
import PIL
from PIL import Image
if len(sys.argv) < 2:
raise Exception("bad parameter")
fn = sys.argv[1]
im =
width, height = im.size
mid = width / 2
box1 = (0, 0, mid, height)
box2 = (mid, 0, width, height)
region1 = im.crop(box1)
region2 = im.crop(box2)
im1 ='RGBA', (width, height))
im1.paste(region2, (0, 0))
im1.paste(region1, (mid, 0))'x_' + fn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.