Files
IYmtg/IYmtg_Automation/generate_placeholders.py
2026-02-24 09:12:46 -05:00

58 lines
1.8 KiB
Python

import os
import sys
try:
from PIL import Image, ImageDraw
except ImportError:
print("❌ Error: Pillow library not found.")
print("👉 Please run: pip install Pillow")
sys.exit(1)
# Configuration
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
RAW_DIR = os.path.join(BASE_DIR, "Raw_Assets")
# Assets to generate (Keys match resize_assets.py)
ASSETS = [
"AppIcon",
"logo_header",
"scanner_frame",
"empty_library",
"share_watermark",
"card_placeholder"
]
def create_placeholders():
if not os.path.exists(RAW_DIR):
os.makedirs(RAW_DIR)
print(f"✅ Created folder: {RAW_DIR}")
print(f"🚀 Generating placeholder images in 'Raw_Assets'...")
for name in ASSETS:
# Generate a generic large square for the raw input
# The resize script handles cropping, so we just need a valid image source
# We use 2048x2048 to simulate a large AI output
img = Image.new('RGB', (2048, 2048), color=(40, 40, 50))
d = ImageDraw.Draw(img)
# Draw a border and text
d.rectangle([50, 50, 1998, 1998], outline=(0, 255, 0), width=40)
# Simple text drawing (default font)
# In a real scenario, you'd replace these with your AI images
d.text((100, 100), f"PLACEHOLDER: {name}", fill=(0, 255, 0))
d.text((100, 200), "Replace with AI Art", fill=(255, 255, 255))
filename = f"{name}.png"
path = os.path.join(RAW_DIR, filename)
# Only create if it doesn't exist to avoid overwriting real AI art
if not os.path.exists(path):
img.save(path)
print(f"✅ Created: {filename}")
else:
print(f"⚠️ Skipped: {filename} (File already exists)")
if __name__ == "__main__":
create_placeholders()