-
Notifications
You must be signed in to change notification settings - Fork 1
/
vaporwave.py
59 lines (47 loc) · 1.76 KB
/
vaporwave.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from PIL import Image
from glob import glob
from random import choice, randint, uniform
from image_utils import *
import numpy as np
import os, cv2
#Set size of output image.
outsize = (1024,768)
#Make file lists.
imagedir = "./images/"
background = glob(imagedir + "background/*")
text = glob(imagedir + "text/*")
# statue = glob(imagedir + "statue/*")
sticker = glob(imagedir + "sticker/*")
window = glob(imagedir + "window/*")
#Import random background image and resize to CANVAS SIZE.
im = Image.open(choice(background)).resize(outsize).convert("RGBA")
# styles = ["cascade-box", "sticker", "statue"]
styles = ["cascade-box", "sticker"]
chosen = choice(styles)
if chosen == "cascade-box":
#Make dialog box cascade.
im = insert_cascade(choice(window), im, uniform(0.1, 0.3),
randint(0,256), randint(0,128))
#Insert text
x, y = [choice([50,550]), choice([50,450])]
im = insert_pic(choice(text), im, 0, x, y)
elif chosen == "sticker":
#Spam stickers at random locations and orientations.
for _ in range(randint(10,20)):
#Insert random sticker.
x, y, k = [randint(-200, 900), randint(-200, 600), randint(0,364)]
im = insert_pic(choice(sticker), im, k, x, y)
#Insert text
x, y = [choice([50,550]), choice([50,450])]
im = insert_pic(choice(text), im, 0, x, y)
elif chosen == "statue":
#Spam statues at random locations and orientations.
for _ in range(randint(3,5)):
#Insert random statue.
x, y, k = [randint(-200, 900), randint(-200, 600), randint(0,364)]
im = insert_pic(choice(statue), im, k, x, y)
#Insert text
x, y = [choice([50,550]), choice([50,450])]
im = insert_pic(choice(text), im, 0, x, y)
#Save file.
im.save("./aesthetic.png", "PNG")