Initial commit
This commit is contained in:
commit
16345eac4a
5 changed files with 50 additions and 0 deletions
BIN
.DS_Store
vendored
Normal file
BIN
.DS_Store
vendored
Normal file
Binary file not shown.
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
output/*.png
|
||||
BIN
assets/wozard-card.png
Normal file
BIN
assets/wozard-card.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 206 B |
49
main.py
Executable file
49
main.py
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import print_function
|
||||
from wand.image import Image
|
||||
from wand.drawing import Drawing
|
||||
from wand.color import Color
|
||||
|
||||
|
||||
def main():
|
||||
colors = ['red', 'green', 'blue', 'yellow']
|
||||
special_cards = ['W', 'N']
|
||||
|
||||
for color in colors:
|
||||
for i in range(1, 14):
|
||||
draw_card_face_number(color, i)
|
||||
|
||||
for sign in special_cards:
|
||||
draw_card_face_special('white', sign)
|
||||
|
||||
def draw_card_face_number(color, symbol):
|
||||
with Image(filename='assets/wozard-card.png') as img:
|
||||
img = draw_symbol(img, symbol, color, 90, 130)
|
||||
img = draw_symbol(img, symbol, color, int(img.width - 90), 130)
|
||||
img.flip()
|
||||
img = draw_symbol(img, symbol, color, 90, 130)
|
||||
img = draw_symbol(img, symbol, color, int(img.width - 100), 130)
|
||||
img.save(filename='output/card-{}-{}.png'.format(color, symbol))
|
||||
|
||||
def draw_card_face_special(color, symbol):
|
||||
with Image(filename='assets/wozard-card.png') as img:
|
||||
img = draw_symbol(img, symbol, color, 90, 130)
|
||||
img = draw_symbol(img, symbol, color, int(img.width - 90), 130)
|
||||
img.flip()
|
||||
img = draw_symbol(img, symbol, color, 90, 130)
|
||||
img = draw_symbol(img, symbol, color, int(img.width - 100), 130)
|
||||
img.save(filename='output/card-{}-{}.png'.format(color, symbol))
|
||||
|
||||
def draw_symbol(img, symbol, color, x, y):
|
||||
with Drawing() as draw:
|
||||
draw.font = 'wandtests/assets/League_Gothic.otf'
|
||||
draw.font_size = 100
|
||||
draw.text_alignment = 'center'
|
||||
draw.fill_color=Color(color)
|
||||
draw.text(x, y, str(symbol))
|
||||
draw(img)
|
||||
|
||||
return img
|
||||
|
||||
main()
|
||||
0
output/.gitkeep
Normal file
0
output/.gitkeep
Normal file
Loading…
Add table
Reference in a new issue