I Habd A Code

I’m a bit under the weather, so all I’ve got today is a quick set of useful co-ordinates. They are: (47, 159).

Explanation

Ok, a brief explanation. You may want to extract screenshots from the iPhone simulator, e.g. for submission to the iTunes store. If you take a screenshot of the iPhone simulator’s window (with, say, Cmd-Shift-4 + Space + Left-Click), you end up with an image of an iPhone wrapped around the application that you’re actually interested in. In that image, the iPhone’s “screen” begins at (47, 139) if you assume that the (0, 0) origin is in the UL corner. Since you typically don’t want to include the status bar in screenshots, the 320×460 area of the image that you actually care about begins at (47, 159).

If you have a bunch of screenshots in a directory, you can bulk-process them with this Python code (which uses the Python Imaging Library):

>>> import Image
>>> import os
>>> for fn in os.listdir('.'):
...     if fn[-4:].upper()=='.PNG': Image.open(fn).crop((47, 159, 47+320, 159+460)).save(fn)
Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • HackerNews
  • del.icio.us
  • Google Bookmarks
  • Slashdot
This entry was posted in iPhone, Python. Bookmark the permalink.