Beispiel #1
0
def create_title(base, page_size, photo_rect, group_name):
    shadow = 2
    darkgreen = (41, 105, 13, 255)
    green = (67, 173, 22, 255)
    white = (255, 255, 255, 255)
    # margin = 48
    draw = ImageDraw.Draw(base)
    group_font = ImageFont.truetype(os.path.join('fonts', 'CooperBlackStd-Italic.otf'), 120)
    textdraw = TextDraw(draw)
    group_rect = textdraw.centre(
        (0, photo_rect[3], page_size[0], page_size[1] - (page_size[1] - photo_rect[3]) / 3),
        group_name, group_font)
    # biggroup = (0, group_rect[1], page_size[0], group_rect[3])
    draw.rectangle(group_rect, fill=white)
    textdraw.text(group_rect, group_name, darkgreen, group_font, shadow, green)
Beispiel #2
0
def create_title(base, page_size, photo_rect, group_name):
    shadow = 2
    darkgreen = (41, 105, 13, 255)
    green = (67, 173, 22, 255)
    white = (255, 255, 255, 255)
    # margin = 48
    draw = ImageDraw.Draw(base)
    group_font = ImageFont.truetype("fonts/CooperBlackStd-Italic.otf", 120)
    textdraw = TextDraw(draw)
    group_rect = textdraw.centre(
        (0, photo_rect[3], page_size[0], page_size[1] - (page_size[1] - photo_rect[3]) / 3), group_name, group_font
    )
    # biggroup = (0, group_rect[1], page_size[0], group_rect[3])
    draw.rectangle(group_rect, fill=white)
    textdraw.text(group_rect, group_name, darkgreen, group_font, shadow, green)
def create_title(base, page_size, photo_rect, day, timeid):
    year = tools.get_year()
    day_timeid = day + '/' + timeid
    # title = "Christmas Experience"
    subtitle = "December - {}".format(year)
    copy = u"© {} East Lancashire Scouts".format(year)
    shadow = 2
    darkred = (176, 7, 7, 255)
    red = (238, 9, 9, 255)
    # darkgreen = (41, 105, 13, 255)
    # green = (67, 173, 22, 255)
    # black = (0, 0, 0, 255)
    grey = (65, 90, 104, 255)
    margin = 48
    cal_top = 2100
    cal_bottom = 3350
    draw = ImageDraw.Draw(base)
    #titleFont = ImageFont.truetype(os.path.join('fonts', 'BookmanDemi.pfb'), 144)
    subtitle_font = ImageFont.truetype(os.path.join('fonts', 'BookmanDemi.pfb'), 120)
    #groupFont = ImageFont.truetype(os.path.join('fonts', 'CooperBlackStd-Italic.otf'), 120)
    small_font = ImageFont.truetype(os.path.join('fonts', 'DejaVuSans.ttf'), 42)
    textdraw = TextDraw(draw)
    #title_rect = textdraw.centre(
    #    (0, margin * 2, page_size[0], photo_rect[1] / 2),
    #    title, titleFont)
    #group_rect = textdraw.centre(
    #    (0, photo_rect[1] / 2, page_size[0], photo_rect[1]),
    #    group_name, groupFont)
    subtitle_rect = textdraw.centre(
        (0, photo_rect[3], page_size[0], cal_top),
        subtitle, subtitle_font)
    timeid_rect = textdraw.left(
        (photo_rect[0], cal_bottom, page_size[0], page_size[1] - margin),
        day_timeid, small_font)
    copy_rect = textdraw.right(
        (0, cal_bottom, photo_rect[2], page_size[1] - margin),
        copy, small_font)
    #textdraw.text(title_rect, title, red, titleFont, shadow, darkred)
    #textdraw.text(group_rect, group_name, darkgreen, groupFont, shadow, green)
    textdraw.text(subtitle_rect, subtitle, red, subtitle_font, shadow, darkred)
    textdraw.text(timeid_rect, day_timeid, grey, small_font)
    textdraw.text(copy_rect, copy, grey, small_font)
Beispiel #4
0
def create_title(base, group_name, day, timeid):
    day_timeid = day + '/' + timeid
    shadow = 2
    black = (0, 0, 0, 255)
    white = (255, 255, 255, 255)
    grey = (65, 90, 104, 255)
    draw = ImageDraw.Draw(base)
    group_font = ImageFont.truetype(os.path.join('fonts', 'DejaVuSans.ttf'),
                                    120)
    small_font = ImageFont.truetype(os.path.join('fonts', 'DejaVuSans.ttf'),
                                    42)
    textdraw = TextDraw(draw)
    group_rect = textdraw.centre((1118, 158, 3053, 430), group_name,
                                 group_font)
    timeid_rect = textdraw.right((886, 2339, 3215, 2393), day_timeid,
                                 small_font)
    textdraw.text(group_rect, group_name, black, group_font)
    textdraw.text(timeid_rect, day_timeid, grey, small_font, shadow, white)
Beispiel #5
0
def create_title(base, group_name, day, timeid):
    day_timeid = day + '/' + timeid
    shadow = 2
    black = (0, 0, 0, 255)
    white = (255, 255, 255, 255)
    grey = (65, 90, 104, 255)
    draw = ImageDraw.Draw(base)
    group_font = ImageFont.truetype(os.path.join('fonts', 'DejaVuSans.ttf'), 120)
    small_font = ImageFont.truetype(os.path.join('fonts', 'DejaVuSans.ttf'), 42)
    textdraw = TextDraw(draw)
    group_rect = textdraw.centre(
        (1118, 158, 3053, 430),
        group_name, group_font)
    timeid_rect = textdraw.right(
        (886, 2339, 3215, 2393),
        day_timeid, small_font)
    textdraw.text(group_rect, group_name, black, group_font)
    textdraw.text(timeid_rect, day_timeid, grey, small_font, shadow, white)
def create_title(base, page_size, photo_rect, day, timeid):
    year = tools.get_year()
    day_timeid = day + '/' + timeid
    # title = "Christmas Experience"
    subtitle = "December - {}".format(year)
    copy = u"© {} East Lancashire Scouts".format(year)
    shadow = 2
    darkred = (176, 7, 7, 255)
    red = (238, 9, 9, 255)
    # darkgreen = (41, 105, 13, 255)
    # green = (67, 173, 22, 255)
    # black = (0, 0, 0, 255)
    grey = (65, 90, 104, 255)
    margin = 48
    cal_top = 2100
    cal_bottom = 3350
    draw = ImageDraw.Draw(base)
    #titleFont = ImageFont.truetype(os.path.join('fonts', 'BookmanDemi.pfb'), 144)
    subtitle_font = ImageFont.truetype(
        os.path.join('fonts', 'BookmanDemi.pfb'), 120)
    #groupFont = ImageFont.truetype(os.path.join('fonts', 'CooperBlackStd-Italic.otf'), 120)
    small_font = ImageFont.truetype(os.path.join('fonts', 'DejaVuSans.ttf'),
                                    42)
    textdraw = TextDraw(draw)
    #title_rect = textdraw.centre(
    #    (0, margin * 2, page_size[0], photo_rect[1] / 2),
    #    title, titleFont)
    #group_rect = textdraw.centre(
    #    (0, photo_rect[1] / 2, page_size[0], photo_rect[1]),
    #    group_name, groupFont)
    subtitle_rect = textdraw.centre((0, photo_rect[3], page_size[0], cal_top),
                                    subtitle, subtitle_font)
    timeid_rect = textdraw.left(
        (photo_rect[0], cal_bottom, page_size[0], page_size[1] - margin),
        day_timeid, small_font)
    copy_rect = textdraw.right(
        (0, cal_bottom, photo_rect[2], page_size[1] - margin), copy,
        small_font)
    #textdraw.text(title_rect, title, red, titleFont, shadow, darkred)
    #textdraw.text(group_rect, group_name, darkgreen, groupFont, shadow, green)
    textdraw.text(subtitle_rect, subtitle, red, subtitle_font, shadow, darkred)
    textdraw.text(timeid_rect, day_timeid, grey, small_font)
    textdraw.text(copy_rect, copy, grey, small_font)
Beispiel #7
0
from figlet import generate
from textdraw import TextDraw
from textmul import multiply

from sys import argv

ID = argv[1]
SURNAME = argv[2]
NAME = argv[3]
GRAD = argv[4] + ' класс'

YEAR = '2014'

T = TextDraw(128, 320)

T.box(0, 0, 127, 319)

T.box(3, 3, 35, 315)
T.puttext(generate('Региональный этап'), 5, 5, y1=314)
T.puttext(generate('всероссийской олимпиады школьников'), 15, 5, y1=314)
T.puttext(generate('по информатике'), 25, 5, y1=314)

T.box(36, 3, 84, 315)

T.box(30, 228, 40, 290)
T.puttext(generate(YEAR), 32, 230, y1=288)
T.box(30, 28, 40, 90)
T.puttext(generate(GRAD), 32, 30, y1=86)

T.box(85, 3+133+56, 124, 181+134)
T.puttext(open('banner').read(), 87, 5+134+56)