Exemple #1
0

def save_fix_height(img, name, root='./Logos/', fixed_height=120):

    width, height = img.size
    width = int(width * fixed_height / height)
    size = (width, fixed_height)
    img = img.resize(size, Image.ANTIALIAS)
    if not os.path.exists(root): os.makedirs(root)
    img.save(root + name + '.bmp', quality=100)


if __name__ == '__main__':

    logo = Logo()

    # example 1
    logo.set_font('typography')
    logo.set_colors('Noon to Dusk')
    logo.set_content('curme')
    logo_img = logo.draw()
    save_fix_height(logo_img, 'example1')

    # example 2
    with open('./Workers/gea6.logo', 'r+') as f:
        layout = f.read().split('\n')
    logo.set_layout(layout)
    logo.set_colors('Sea Blue')
    logo_img = logo.draw()
    save_fix_height(logo_img, 'example2')
Exemple #2
0
    store_root = './Logos/'

    logo = Logo()

    content = 'curme'

    # get fonts
    fonts = os.listdir('./Fonts/')
    fonts = [font for font in fonts \
        if len(font.split('.'))==1]

    # get colors
    colors = os.listdir('./Colors/')
    colors = [color.split('.')[0] for color in \
        colors if color.split('.')[-1]=='jpg']


    for font in fonts:
        logo.set_font(font)
        logo.set_content(content)

        for color in colors:
            logo.set_colors(color)

            logo_img = logo.draw()            
            save_path = store_root + content + '/'
            save_path+= font + '/'
            img_name = color + '.bmp'
            if not os.path.exists(save_path): os.makedirs(save_path)
            logo_img.save(save_path + img_name)