Skip to content

Commit 81d68e5

Browse files
committed
0010
1 parent 84198f4 commit 81d68e5

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# -*- coding: utf-8 -*-
2+
__author__ = 'PatchLion'
3+
4+
from PIL import Image, ImageDraw, ImageFont, ImageFilter
5+
import random
6+
7+
def randChar():
8+
#65-90 A-Z
9+
return chr(random.randint(65, 90))
10+
11+
def randColor():
12+
return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
13+
14+
def createIdentifyingCode(size, charcount=4):
15+
width=size*charcount
16+
height=size
17+
18+
img = Image.new('RGB', (width, height), (255, 255, 255))
19+
draw = ImageDraw.Draw(img)
20+
for x in range(width):
21+
for y in range(height):
22+
draw.point((x, y), fill=randColor())
23+
24+
font = ImageFont.truetype("../0000/Varela-Regular.otf", size=size)
25+
#draw.text((0, 0), randChar(), fill=randColor())
26+
for i in range(charcount):
27+
draw.text((i*size + 10, -10), randChar(), fill=randColor(), font=font)
28+
29+
img = img.filter(ImageFilter.BLUR)
30+
img.save('ic.jpg', 'jpeg')
31+
32+
createIdentifyingCode(60)
33+

patchlion/0010/ic.jpg

5.23 KB
Loading

0 commit comments

Comments
 (0)