-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_overlay_to_blended_images.py
31 lines (21 loc) · 1.04 KB
/
add_overlay_to_blended_images.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""For each class/job, blend all action and trait images."""
import json
import os
import pathlib
from PIL import Image
THIS_FILE_DIR_PATH = pathlib.Path(__file__).parent.resolve()
for cj_json_filename in os.listdir(THIS_FILE_DIR_PATH / 'class_job_info'):
cj_json_path = THIS_FILE_DIR_PATH / 'class_job_info' / cj_json_filename
with open(cj_json_path, 'r') as infile:
cj_info = json.load(infile)
cj_abbrev = cj_info['Abbreviation']
blended_image = Image.open(THIS_FILE_DIR_PATH / 'icons_blended_hd' / 'actions_only' / f'{cj_info["Abbreviation"]}.png')
print('Overlaying image for', cj_abbrev)
cj_icon = Image.open(THIS_FILE_DIR_PATH / 'icons' / 'class_job_icons' / f'{cj_info["Abbreviation"]}.png')
cj_icon = cj_icon.resize((80, 80))
if blended_image.size == (80, 80):
blended_image.paste(cj_icon, (0, 0), cj_icon)
else:
continue
cj_bi_out_path = THIS_FILE_DIR_PATH / 'icons_blended_hd' / 'actions_only_w_overlay' / f'{cj_info["Abbreviation"]}.png'
blended_image.save(cj_bi_out_path)