Untitled
unknown
plain_text
17 days ago
3.6 kB
2
Indexable
from PIL import Image, ImageDraw, ImageFont, ImageFilter import random # Image dimensions for YouTube banner width, height = 2560, 1440 img = Image.new("RGB", (width, height), "black") draw = ImageDraw.Draw(img) # Create a vertical gradient from purple (128, 0, 128) to blue (0, 0, 255) for y in range(height): # Linear interpolation for red and blue channels r = int(128 * (1 - y/height)) # 128 to 0 b = int(128 + (127 * y/height)) # 128 to 255 line_color = (r, 0, b) draw.line([(0, y), (width, y)], fill=line_color) # Add subtle abstract circles for visual interest # We use an overlay for a semi-transparent effect overlay = Image.new("RGBA", (width, height), (255, 255, 255, 0)) overlay_draw = ImageDraw.Draw(overlay) for _ in range(20): # Random position and size x = random.randint(0, width) y = random.randint(0, height) radius = random.randint(100, 300) # Draw ellipse with very low opacity (20 out of 255) overlay_draw.ellipse((x - radius, y - radius, x + radius, y + radius), fill=(255, 255, 255, 20)) # Composite the overlay onto the background img = Image.alpha_composite(img.convert("RGBA"), overlay) # Prepare to draw the channel text "menaceamv" in the center draw = ImageDraw.Draw(img) text = "menaceamv" # Attempt to use a bold, modern font; fallback to default if not available. try: # This font is commonly available on many systems. font = ImageFont.truetype("DejaVuSans-Bold.ttf", 200) except IOError: font = ImageFont.load_default() # Calculate text size and position (centered) text_width, text_height = draw.textsize(text, font=font) text_x = (width - text_width) / 2 text_y = (height - text_height) / 2 # Add a subtle shadow for depth shadow_color = (0, 0, 0) draw.text((text_x + 5, text_y + 5), text, font=font, fill=shadow_color) # Draw the main text in white draw.text((text_x, text_y), text, font=font, fill=(255, 255, 255)) # Save the final image img.convert("RGB").save("youtube_cover.jpg") img.show() # Opens the image using your system's default image viewer
Editor is loading...
Leave a Comment