Coordinates-based text display upon an image with Django's template system -


i trying update excel-map data fetched django , display on page linked admin.

the excel-"map" :

enter image description here

using xlrd & cie libs i'm working on fetching / updating data part fellow dev told me have used image instead.

my question : how such thing ? displaying copy of above spreadsheet , using row-based coordinates write data want ? (text data)

do guys know way work coordinate-based text display in django's templates ?

thanks can give me !

i ended using pil library. quite easy , summarized following code :

from pil import image pil import imagedraw pil import imagefont  im = image.open('path/to/map.png') font = imagefont.truetype('/usr/share/fonts/dejavu/dejavusans.ttf', 7) draw = imagedraw.draw(im)  draw.text((x, y), sentence, font=font, fill='black')  response = httpresponse(mimetype='image/png') im.save(response, 'png')  return response 

logic behind x , y irrelevant here, bear in mind start quite illogically on upper left corner of image , go there right , bottom positive numbers.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -