improve indiancine.ma poster script (light text on dark background seems to compress better)

This commit is contained in:
rolux 2013-03-19 14:28:07 +05:30
parent 65e2825f65
commit 6d2b8f33e3

View file

@ -31,7 +31,7 @@ def render_poster(title, director, year, frame, timeline, poster):
draw = ImageDraw.Draw(poster_image) draw = ImageDraw.Draw(poster_image)
font_file = os.path.join(static_root, 'SourceSansProSemibold.ttf') font_file = os.path.join(static_root, 'SourceSansProSemibold.ttf')
font_size = {'cinema': 107, 'director': 32, 'title': 48, 'year': 387} font_size = {'cinema': 107, 'director': 32, 'title': 48, 'year': 387}
font_lightness = {'cinema': 0.8 if year else 0.6, 'director': 0.2, 'title': 0.2, 'year': 0.6} font_lightness = {'cinema': 0.7, 'director': 0.8, 'title': 0.8, 'year': 0.6}
poster_lightness = {'image': 0.2, 'text': 0.4} poster_lightness = {'image': 0.2, 'text': 0.4}
if year: if year:
@ -59,6 +59,16 @@ def render_poster(title, director, year, frame, timeline, poster):
) )
# cinema # cinema
for y in [-1, 1]:
for x in [-1, 1]:
drawText(
poster_image,
(-10 + x, poster_height - timeline_height - font_size['cinema'] + 1 + y),
'Indiancine.ma',
font_file,
font_size['cinema'],
getRGB((hue, saturation, poster_lightness['text']))
)
drawText( drawText(
poster_image, poster_image,
(-10, poster_height - timeline_height - font_size['cinema'] + 1), (-10, poster_height - timeline_height - font_size['cinema'] + 1),
@ -112,6 +122,16 @@ def render_poster(title, director, year, frame, timeline, poster):
font_size['title'] font_size['title']
) )
for line in lines: for line in lines:
for y in [-1, 1]:
for x in [-1, 1]:
drawText(
poster_image,
(text_margin + x, offset_top + 4 + y),
line,
font_file,
font_size['title'],
getRGB((hue, saturation, poster_lightness['text']))
)
drawText( drawText(
poster_image, poster_image,
(text_margin, offset_top + 4), (text_margin, offset_top + 4),