annotate scripts/fonts_test.py @ 139:7d8366fb90bf

Ajouté des __init__.py dans l'arborescence pour que les scripts puissent être utilisés avec des paths pour jobman, et fait pas mal de modifs dans stacked_dae pour pouvoir réutiliser le travail fait pour des tests où le pretraining est le même.
author fsavard
date Mon, 22 Feb 2010 13:38:25 -0500
parents 36010ff90255
children bb26c12bb9f6
rev   line source
135
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
1
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
2 import random, os
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
3 import ImageFont, ImageDraw, Image
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
4
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
5 dir1 = "/data/lisa/data/ift6266h10/allfonts/"
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
6
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
7 img = Image.new("L", (100,100))
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
8 draw = ImageDraw.Draw(img)
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
9
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
10 for f in os.listdir(dir1):
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
11 try:
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
12 font = ImageFont.truetype(dir1+f, 25)
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
13 textSize = font.getsize("kD9")
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
14 except:
36010ff90255 Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff changeset
15 print dir1+f