Docs: Update Game Bible logic, import references, session log Jan 24
This commit is contained in:
42
add_greenscreen_kai.py
Normal file
42
add_greenscreen_kai.py
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Add Green Screen Background to Kai
|
||||
Adds alpha 24 green (#00FF00) background to transparent image
|
||||
"""
|
||||
|
||||
from PIL import Image
|
||||
import os
|
||||
|
||||
# Input/Output
|
||||
input_file = "/Users/davidkotnik/repos/novafarma/assets/slike/glavna_referenca/kai1.png"
|
||||
output_file = "/Users/davidkotnik/repos/novafarma/assets/slike/glavna_referenca/kai_greenscreen.png"
|
||||
|
||||
print("🎨 ADDING GREEN SCREEN BACKGROUND TO KAI\n")
|
||||
|
||||
# Load image
|
||||
print(f"📂 Loading: {os.path.basename(input_file)}")
|
||||
img = Image.open(input_file)
|
||||
|
||||
# Get size
|
||||
width, height = img.size
|
||||
print(f"📐 Size: {width}x{height}px")
|
||||
|
||||
# Create green background (Chroma Key Green #00FF00)
|
||||
green_bg = Image.new('RGBA', (width, height), (0, 255, 0, 255))
|
||||
|
||||
# Composite: green background + original image on top
|
||||
if img.mode == 'RGBA':
|
||||
# Image has alpha channel - composite it on green
|
||||
result = Image.alpha_composite(green_bg, img)
|
||||
else:
|
||||
# No alpha - convert and place on green
|
||||
img_rgba = img.convert('RGBA')
|
||||
result = Image.alpha_composite(green_bg, img_rgba)
|
||||
|
||||
# Save
|
||||
result.save(output_file)
|
||||
|
||||
print(f"\n✅ SUCCESS!")
|
||||
print(f"📁 Saved: {os.path.basename(output_file)}")
|
||||
print(f"🎨 Background: Chroma Key Green (#00FF00)")
|
||||
print(f"📍 Location: {output_file}")
|
||||
Reference in New Issue
Block a user