-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
28 lines (21 loc) · 1007 Bytes
/
example.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
import os, random
from ImageQuote import ImageQuote
bg_files = []
for root, subdirs, files in os.walk("./backgrounds"):
for file in files:
bg_files.append(os.path.join(root, file))
font_files = []
for root, subdirs, files in os.walk("./fonts/hindi"):
for file in files:
font_files.append(os.path.join(root, file))
random_background = os.path.abspath(random.choice(bg_files))
random_font = os.path.abspath(random.choice(font_files))
image = ImageQuote()
# image.set_top_text("आज का सुविचार")
image.set_quote("स्वार्थ संसार का एक ऐसा कुआं है जिसमें गिरकर निकल पाना बड़ा कठिन होता हैं।")
image.set_quote_by("भगवान श्री कृष्ण")
image.set_font_family(random_font)
image.set_background_image(random_background)
image.set_output_file_size(35000)
# generate image in current directory
image.generate_image("./output")