Spaces:
Sleeping
Sleeping
| from PIL import Image, ImageDraw | |
| def create_gradient_image(width, height, start_color, end_color): | |
| base = Image.new('RGB', (width, height), start_color) | |
| top = Image.new('RGB', (width, height), end_color) | |
| mask = Image.new('L', (width, height)) | |
| mask_data = [] | |
| for y in range(height): | |
| for x in range(width): | |
| mask_data.append(int(255 * (y / height))) | |
| mask.putdata(mask_data) | |
| base.paste(top, (0, 0), mask) | |
| return base | |
| def main(): | |
| # Create a nice gradient background (Purple to Blue/Pink) | |
| # Dimensions: Enough for 4 slides of 3:4 (1080x1350) | |
| # 4 * 1080 = 4320 width | |
| # But user might want it stretched, so let's make a generic 16:9 or similar high res | |
| # Let's make a 4000x3000 image to be safe | |
| # Soft mesh gradient style (simulated with linear gradient for simplicity) | |
| # Start: #e0c3fc (Light Purple) | |
| # End: #8ec5fc (Light Blue) | |
| img = create_gradient_image(2000, 1500, (224, 195, 252), (142, 197, 252)) | |
| # Add some "noise" or pattern to make it look professional? | |
| # Let's keep it simple gradient for now, clean and modern. | |
| import os | |
| if not os.path.exists('static'): | |
| os.makedirs('static') | |
| img.save('static/default_bg.png') | |
| print("Created static/default_bg.png") | |
| if __name__ == "__main__": | |
| main() | |