doom
This commit is contained in:
45
finalize_v4_assets.py
Normal file
45
finalize_v4_assets.py
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
import os
|
||||
from PIL import Image
|
||||
|
||||
def process_and_save(source_path, dest_path, target_size):
|
||||
try:
|
||||
img = Image.open(source_path).convert("RGBA")
|
||||
datas = img.getdata()
|
||||
|
||||
newData = []
|
||||
# Tolerance for black background removal
|
||||
threshold = 15
|
||||
|
||||
for item in datas:
|
||||
# Check if pixel is black (allowing for slight compression noise)
|
||||
if item[0] < threshold and item[1] < threshold and item[2] < threshold:
|
||||
newData.append((0, 0, 0, 0)) # Transparent
|
||||
else:
|
||||
newData.append(item)
|
||||
|
||||
img.putdata(newData)
|
||||
|
||||
# Resize using Lanczos for quality
|
||||
img = img.resize(target_size, Image.Resampling.LANCZOS)
|
||||
|
||||
# Save to final destination
|
||||
img.save(dest_path, "PNG")
|
||||
print(f"✅ Success: {dest_path}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ Error: {e}")
|
||||
|
||||
# Source files (New V4 generations with black bg from Brain)
|
||||
frame_source = "/Users/davidkotnik/.gemini/antigravity/brain/998d0b10-1733-4e5b-85ed-249b986ba9b3/okvir_zarjavel_v4_1768958404477.png"
|
||||
gauge_source = "/Users/davidkotnik/.gemini/antigravity/brain/998d0b10-1733-4e5b-85ed-249b986ba9b3/merilec_zdravja_v4_1768958417465.png"
|
||||
|
||||
# Destination directory
|
||||
dest_dir = "/Users/davidkotnik/repos/novafarma/assets/slike/NOVE_SLIKE/UI"
|
||||
|
||||
# Execution
|
||||
# 1. Rusty Frame (800x250)
|
||||
process_and_save(frame_source, os.path.join(dest_dir, "okvir_zarjavel.png"), (800, 250))
|
||||
|
||||
# 2. Health Gauge (150x150) - Resizing to match scene usage
|
||||
process_and_save(gauge_source, os.path.join(dest_dir, "merilec_zdravja.png"), (150, 150))
|
||||
Reference in New Issue
Block a user