This commit is contained in:
Alexander Popov 2021-02-25 10:33:08 +03:00
parent fadf2226e7
commit 55cb3e4e57
Signed by: iiiypuk
GPG Key ID: 398FC73478D97286
5 changed files with 43 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
venv/
images/
logo.png

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# Apple Splash Screen Maker
![Preview](preview.png)

26
assm.py Normal file
View File

@ -0,0 +1,26 @@
import json
from PIL import Image
def getDevicesList():
with open('./devicesArrays.json', encoding='utf-8') as f:
raw = f.read()
return(json.loads(raw))
if __name__ == '__main__':
devicesList = getDevicesList()
for device in devicesList:
device_w = devicesList[device][0]
device_h = devicesList[device][1]
device_r = round(device_w / 5)
image_w_center = round((device_w / 2) - (device_r / 2))
image_h_center = round((device_h / 2) - (device_r / 2))
base_image = Image.new('RGB', (device_w, device_h), (255, 255, 255))
logo_image = Image.open('./logo.png')
a = logo_image.resize((device_r, device_r))
base_image.paste(a, (image_w_center, image_h_center), a)
base_image.save('./images/splash-portrait-{width}x{height}.png'.format(
width=device_w, height=device_h))

12
devicesArrays.json Normal file
View File

@ -0,0 +1,12 @@
{
"iPhone SE": [640, 1136],
"iPhone 6/7/8": [750, 1334],
"iPhone XR": [828, 1792],
"iPhone X": [1125, 2436],
"iPhone 8 Plus": [1242, 2208],
"iPhone XS Max": [1242, 2688],
"9.7\" iPad": [1536, 2048],
"10.5\" iPad Pro": [1668, 2224],
"11\" iPad Pro": [1668, 2388],
"12.9\" iPad Pro": [2048, 2732]
}

BIN
preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB