createiOSWallpaper.py

A recent need for managing iPads within my workplace is creating a custom wallpaper for each device that includes a picture of the person the device is assigned to, as well as their name and a QR code for the asset details, plus the organisation logo. Given the large number of these devices, creating wallpapers by hand is out of the question.

Python to the rescue.

What you’ll need:

  • python 2.7.10 (minimum)
  • pillow (pip install pillow)
  • qrcode (pip install qrcode)

Both pillow and qrcode may have additional dependancies to install.

I’ve uploaded a sample bit of code to https://github.com/carlashley/createiOSWallpaper/

The code will build a wallpaper image based on the specified target device (check the resolutions dictionary for supported devices, can easily be extended to include iPhones), and will also check if the picture of the user being inserted into the wallpaper exceeds the wallpapers width/height and resize it down.

The QR code is dynamically generated and dropped into the image, in a centre alignment, offset from the corporate logo. The user’s name is dropped onto the bottom of the image with some vertical padding and a horizontal centre alignment.

The user’s name text is single line, but could be made into a multiline text string, you would need to take into account the new height of the multiline text however, or use another method to wrap the multiline text and re-calculate the line heights.

This could be used in conjunction with your MDM to create a wallpaper for each iOS device managed by the MDM (if your MDM supports setting the device background via API).

Here’s a simple video of the tool in action. In this sample, a wallpaper is created for each of the different iPad hardware versions (note, a number of iPad hardware models have the same resolution).

Creating an iOS device wallpaper with python
createiOSWallpaper.py in action