forked from Show-Me-the-Code/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.py
More file actions
29 lines (20 loc) · 721 Bytes
/
Test.py
File metadata and controls
29 lines (20 loc) · 721 Bytes
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
__author__ = 'Tracy'
import Image,ImageDraw,ImageFont,ImageFilter
import random
image = Image.new('RGB', (50*4, 50), (255,255,255))
font = ImageFont.truetype('DejaVuSansMono.ttf', 24)
draw = ImageDraw.Draw(image)
def randColor():
return (random.randint(64,255), random.randint(64,255), random.randint(64,255))
def randColor2():
return (random.randint(32,127), random.randint(32,127), random.randint(32,127))
def randChar():
return chr(random.randint(65,90))
for x in range(50*4):
for y in range(50):
draw.point((x, y), randColor())
for x in range(4):
draw.text((50*x+10, 10), randChar(), randColor2(), font)
image = image.filter(ImageFilter.BLUR)
image.save('Result.jpg')
image.show()