Python script to compose iPhone marketing images

Email This Post Email This Post

An excuse to use Python

I consider myself a polyglot programmer and try to learn a new language every now and again. My latest is Python and I can say that I love it! It’s easy to learn, has a HUGE library, very good support for lists and dictionaries and is flexible enough to be an ideal choice from small scripts to large frameworks.

I’ve been doing a lot of Python scripts for all sorts of small jobs and my latest script might be of interest to some of the readers of this blog.

I was creating a press kit for my latest app and I wanted to get some screenshots of the app and compose them inside an iPhone image.

So, I wanted to get the image on the left and create the one on the right:


Of course I could use PhotoShop or Pixelmator and do this all manually but I had 8 of these and a craving for Python. So I fired up CodeRunner and started writing a Python script. Turns out that, with the use of the incredible Python Imaging Library it was a breeze.

So I decided to open source this so everyone could use it: Feel free to grab it, fork it, improve it and make a pull request.


This script uses PIL. The easiest way to install PIL is using pip:

sudo pip install PIL

Using the script

To use the script place your screenshot files in the same folder as the script and the EmptyiPhone.png file and run it. The script will create new files with ss_ prefixes for all .png files found in the folder.

Changing the iPhone image

To use a different image or to adapt the script for an iPad screen for example, change the EmptyiPhone.png image or the name of the image in the script and change the coordinates used to paste the original screen shots. I plan to automate this step by analyzing the image and finding the transparent rectangle in the middle but so far this is a manual step.

Hope you like it.

Herbal remedies uterine fibroids 2013 herbal remedies uterine fibroids 2013. Fucked on cam fucked on cam. Orgasms on cam orgasms on cam. Tinnitus treatment alcoholism drug tinnitus treatment alcoholism drug. Diet pills nicole richie diet pills nicole richie. How to treat scalp psoriasis how to treat scalp psoriasis. Polycystic ovary syndrome hair loss treatment polycystic ovary syndrome hair loss treatment. Laparoscopy remove ovarian cyst laparoscopy remove ovarian cyst. How to calm psoriasis how to calm psoriasis. Ringing in ears causes and treatments ringing in ears causes and treatments. Natural remedies psoriatic arthritis natural remedies psoriatic arthritis. Bacterial vaginosis counter bacterial vaginosis counter. Free beginner piano pop songs free beginner piano pop songs. Acai passos mg acai passos mg. Hoodia pills holland and barrett hoodia pills holland and barrett. Cure for tinnitus 2014 cure for tinnitus 2014. Wood garden arbors plans wood garden arbors plans. Supplements for gout supplements for gout. External piles remedy external piles remedy. Natural remedy acid reflux natural remedy acid reflux. Uterine fibroids pelvic pain uterine fibroids pelvic pain. Phentermine b12 weight loss phentermine b12 weight loss. Tmj uconn tmj uconn. Does starflower oil help psoriasis does starflower oil help psoriasis. Supplement regimen pcos supplement regimen pcos. Men spy camera men spy camera. Hoodia extrakt 500 mg hoodia extrakt 500 mg. Best diet pills 2014 fda approved best diet pills 2014 fda approved. Psoriasis high protein diet psoriasis high protein diet. Curing hair loss curing hair loss

Keep tuned for more technical and non technical posts. You can subscribe by email, RSS or following me on twitter.

Email This Post Email This Post