From 8b11bc3df4c7bec343418da93163176750dbae0a Mon Sep 17 00:00:00 2001 From: Rolux Date: Fri, 17 Sep 2010 16:58:46 +0200 Subject: [PATCH] adding data_root --- oximage/imagetools.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oximage/imagetools.py b/oximage/imagetools.py index 2f6154b..f5b3849 100644 --- a/oximage/imagetools.py +++ b/oximage/imagetools.py @@ -3,10 +3,12 @@ # vi:si:et:sw=4:sts=4:ts=4 from __future__ import division +import os import Image import ImageDraw from ox.image import drawText, wrapText +data_root = os.path.join(os.path.dirname(__file__), 'data') def render_list_icon(options): icon_width = 256 @@ -88,7 +90,7 @@ def render_oxdb_poster(options): poster_ratio = poster_width / poster_height poster_image = Image.new('RGB', (poster_width, poster_height)) draw = ImageDraw.Draw(poster_image) - font_file = 'data/DejaVuSansCondensedBold.ttf' + font_file = os.path.join(data_root, 'DejaVuSansCondensedBold.ttf') font_size = { 'small': 28, 'large': 42, @@ -150,7 +152,7 @@ def render_oxdb_poster(options): # logo logo_height = 32 - logo_image = Image.open('data/logo.poster.png') + logo_image = Image.open(os.path.join(data_root, 'logo.poster.png')) logo_width = int(round(logo_height * logo_image.size[0] / logo_image.size[1])) logo_image = logo_image.resize((logo_width, logo_height), Image.ANTIALIAS) logo_left = text_width - text_margin - logo_width @@ -174,7 +176,7 @@ def render_padma_poster(options): poster_ratio = poster_width / poster_height poster_color = (255, 255, 0) poster_image = Image.new('RGB', (poster_width, poster_height)) - font_file = 'data/DejaVuSansCondensedBold.ttf' + font_file = os.path.join(data_root, 'DejaVuSansCondensedBold.ttf') font_size = 48 # timeline