This commit is contained in:
2026-01-21 11:09:46 +01:00
parent 23342c2fa7
commit 9736f5e5e3
1939 changed files with 392 additions and 0 deletions

41
apply_green_screen.py Normal file
View File

@@ -0,0 +1,41 @@
import os
from PIL import Image
def add_green_background(image_path):
try:
if not os.path.exists(image_path):
print(f"Skipping {image_path}")
return
# Open image
img = Image.open(image_path).convert("RGBA")
# Create solid green background #00FF00
green_bg = Image.new("RGBA", img.size, (0, 255, 0, 255))
# Composite the image on top of the green background
# This fills transparent areas with green
green_bg.alpha_composite(img)
# Save back (removing alpha channel to make it fully opaque green if desired,
# but maintaining format. Usually "chroma key" implies the background is that color).
# We can save as RGB to discard alpha, ensuring it's solid.
final = green_bg.convert("RGB")
final.save(image_path)
print(f"Updated with Green BG: {image_path}")
except Exception as e:
print(f"Error: {e}")
# Files to process (The ones we just cleaned)
files = [
"/Users/davidkotnik/repos/novafarma/assets/slike/NOVE_SLIKE/UI/gumb_start.png",
"/Users/davidkotnik/repos/novafarma/assets/slike/NOVE_SLIKE/UI/merilec_zdravja.png",
"/Users/davidkotnik/repos/novafarma/assets/slike/NOVE_SLIKE/UI/okvir_zarjavel.png",
"/Users/davidkotnik/repos/novafarma/assets/slike/NOVE_SLIKE/UI/amnezija_maska.png"
]
for f in files:
add_green_background(f)