Skip to content

Commit 5f26e7e

Browse files
committed
task 0000 added. Pillow lib needed.
1 parent 3b373bc commit 5f26e7e

4 files changed

Lines changed: 22 additions & 4 deletions

File tree

effy/0000/.DS_Store

6 KB
Binary file not shown.

effy/0000/pillow_chesnut.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env
2+
'''
3+
Pre-request:
4+
1.Have Pillow installed ( $ pip install Pillow)
5+
6+
The reason why I am using the shitty method of "line" is because I CANT NOT USE
7+
ImageFont!! anyone knows why??
8+
>___,<
9+
'''
10+
from PIL import Image, ImageDraw
11+
# open the base pic
12+
minion = Image.open("/Users/effy/Documents/python/effy/0000/zizi.gif").convert('RGBA')
13+
# new a transparent canvas for the annoying number :)
14+
annoying = Image.new('RGBA', minion.size, (255, 255, 255, 0))
15+
# get the drawing context , note that ImageDraw is the actionable module that will CREATE canvas on the base pic
16+
num = ImageDraw.Draw(annoying)
17+
# draw a number with halp opacity
18+
num.line((minion.size[0]-8, 5, minion.size[0]-8, 25), fill=(255, 0, 0, 200), width=3)
19+
num.line((minion.size[0]-8, 5, minion.size[0]-13, 11), fill=(255, 0, 0, 200), width=3)
20+
num.line((minion.size[0]-14, 25, minion.size[0]-2, 25), fill=(255, 0, 0, 200), width=3)
21+
out = Image.alpha_composite(minion, annoying)
22+
out.show()

effy/0000/zizi.gif

5.04 KB
Loading

effy/0002/0002.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
Define and create table/metadata (Alternative 1), or use existing table (Alternative 2)
3333
'''
3434
metadata = MetaData(db)
35-
3635
'''
3736
Alternative 1:
3837
The following code block is of one time use, after initilization of the table
@@ -81,18 +80,15 @@ def __repr__(self):
8180
mapper(Codes, codes)
8281
metadata.create_all(db)
8382

84-
8583
'''
8684
Step 5:
8785
Create instances of Codes class
8886
'''
89-
9087
raw_codes = codeGen(200)
9188
code_list = []
9289
for i in range(len(raw_codes)):
9390
code_list.append(Codes(i+1, raw_codes[i]))
9491

95-
9692
'''
9793
Step 6:
9894
start session. Add records and commit.

0 commit comments

Comments
 (0)