How to genereate required previews for App Store and Google Play fast from emulator screenshots

There is a huge problem to prepare images preview for mobile app stores. And often you have only screenshots of your mobile app taken from emulator (Android or iOS). Now you have to take at least two different types for iPhones (6,5" and 5,5" are required) and one type used twice for iPad (12,9 Pro and 2,3 gen are the same but required twice).
Also it will be a huge pain in the ass to take resize and crop all of them especially when there are more than one language in the app.
So, once I got tired of that and wrote an ultrasimple python script to optimize this process. 

How it works

  • You take just one set of images for each language for iPhone, iPad, Android Phone, Android Tablet.
  • Run my python script python to prepare all the required sets of images.
  • Receive all required and ready to publish to App Store And Google play preview images.

The python script

from PIL import Image, ImageOps
import os

sources_dir = "test/sources"
results_dir = "test/results"
bg_path = 'test/bg1.jpg'

resolutions =  { "iphone": [
                    (2778, 1284), (2208, 1242)
                  "ipad":  [
                    (2732, 2048)

def listdir(path):
  return [f for f in os.listdir(path) if not f.startswith('.')]

def save_screenshot(img, path, file_name):
  except IOError:

for platform in listdir(sources_dir):
  platform_dir = f"{sources_dir}/{platform}"
  lc_folders = listdir(platform_dir)
  print(f"Performing {platform}")
  for lc in lc_folders:
    images_dir = f"{platform_dir}/{lc}"
    print(f"reading images in {images_dir}")
    images = listdir(images_dir)
    for image in images: 
      f = f"{images_dir}/{image}"
      i = 0
      for height, width  in resolutions[platform]:
          screenshot =
          bg =
          fitted =  ImageOps.contain(screenshot, (width, height))
          fwidth, fheight = fitted.size
          processed_image ='RGBA', (width, height), color=(232, 106, 28))
          processed_image.paste(fitted, (int(width/2 - fwidth/2), int(height/2 - fheight/2)))
          save_screenshot(processed_image, f"{results_dir}/{platform}/{lc}/{height}x{width}/", file_name=f"{platform}_{lc}_{height}x{width}_{image}")
          i += 1
        except IOError:
          print(f"Error in processing")

The whole script is available on with all the references to app stores docs and articles that inspired me.

Test run
You can run it as is on a predefined test folder and take a closer look to results at test/results folder. Also please read the to optimize script to your specific needs.
Grab the code at Github —>
Back to articles


Explore Aber Vulgue's blog for expert articles on programming, software development, and DevOps. Dive into practical guides on JavaScript, C++, mobile app development, neural networks, and more to enhance your tech skills.


Non penis canina est!