Tom Tayebi
Prompt
from PIL import Image, ImageDraw
import numpy as np
image_path = "/mnt/data/C4357F88-2E71-4FF7-97DD-11D9EEAC25CD.jpeg"
cat_image = Image.open(image_path)
crown_width = int(cat_image.width * 0.3)
crown_height = int(crown_width * 0.5)
crown_image = Image.new('RGBA', (crown_width, crown_height), (255, 255, 255, 0))
draw = ImageDraw.Draw(crown_image)
draw.rectangle([(0, crown_height * 0.7), (crown_width, crown_height)], fill=(255, 215, 0, 255))
peak_width = crown_width // 5
for i in range(5):
x0 = i * peak_width
x1 = x0 + peak_width
x_middle = (x0 + x1) // 2
draw.polygon([(x0, crown_height * 0.7), (x_middle, 0), (x1, crown_height * 0.7)], fill=(255, 215, 0, 255))
decorations = [
((crown_width * 0.2, crown_height * 0.4), (crown_width * 0.3, crown_height * 0.5), (255, 0, 0, 255)),
((crown_width * 0.7, crown_height * 0.4), (crown_width * 0.8, crown_height * 0.5), (0, 0, 255, 255)),
((crown_width * 0.45, crown_height * 0.1), (crown_width * 0.55, crown_height * 0.2), (0, 255, 0, 255)),
]
for ellipse in decorations:
draw.ellipse(ellipse[:2], fill=ellipse[2])
gradient = np.zeros((crown_height, crown_width, 4), dtype=np.uint8)
for y in range(crown_height):
for x in range(crown_width):
alpha = int(255 * (1 - (y / crown_height) ** 2))
gradient[y, x] = [255, 255, 255, alpha]
gradient_image = Image.fromarray(gradient, 'RGBA')
crown_image = Image.alpha_composite(crown_image, gradient_image)
crown_position = (cat_image.width // 2 - crown_width // 2, cat_image.height // 5)
cat_image_with_crown = cat_image.copy()
cat_image_with_crown.paste(crown_image, crown_position, crown_image)
final_image_path = "/mnt/data/cat_with_shiny_crown.png"
cat_image_with_crown.save(final_image_path)
cat_image_with_crown.show()
from PIL import Image, ImageDraw
import numpy as np
image_path = "/mnt/data/C4357F88-2E71-4FF7-9... [more]
Create your first image using OpenArt.
With over 100+ models and styles to choose from, you can create stunning images.