add: preliminary work for bandages shown on amputations

This commit is contained in:
ZioPao
2025-10-12 17:47:45 +02:00
parent be4588fc43
commit 52de7e8b06
50 changed files with 50 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,35 @@
from pathlib import Path
from PIL import Image
import os
input_bodies_path = Path('input/body')
input_bandages_path = Path('input/bandages')
for body_filepath in input_bodies_path.glob('*.png'): # Only PNG files
for bandage_filepath in input_bandages_path.glob('*.png'): # Only PNG files
print(f'Processing {body_filepath.name} with {bandage_filepath.name}...')
base = Image.open(body_filepath)
overlay = Image.open(bandage_filepath)
body_name = body_filepath.stem.replace('MaleBody', 'skin')
if body_name.endswith('a'):
body_name = body_name[:-1] + '_hairy_b'
else:
body_name = body_name + '_b'
result = base.copy()
result.paste(overlay, (0, 0), mask=overlay) # Use overlay as its own mask
if bandage_filepath.stem == 'MaleBody01_bandages_lower_arm':
output_path = 'output/Bandaged/Forearm/'
elif bandage_filepath.stem == 'MaleBody01_bandages_upper_arm':
output_path = 'output/Bandaged/UpperArm/'
elif bandage_filepath.stem == 'MaleBody01_bandages_lower_arm_blood':
output_path = 'output/Bandaged_Bloody/Forearm/'
elif bandage_filepath.stem == 'MaleBody01_bandages_upper_arm_blood':
output_path = 'output/Bandaged_Bloody/UpperArm/'
os.makedirs(output_path, exist_ok=True)
result.save(f'{output_path}/{body_name}.png')