Mercurial > ift6266
annotate scripts/fonts_test.py @ 153:041d68b34b70
Script utilise pour creer le jeu de donnees utilise pour le module Occlusion.py. De plus, le fichier /data/lisa/data/ift6266h10/echantillon_occlusion.py a change afin d'etre cree avec seed random (jeu reproductible)
author | SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca> |
---|---|
date | Wed, 24 Feb 2010 13:51:18 -0500 |
parents | bb26c12bb9f6 |
children |
rev | line source |
---|---|
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
1 #!/usr/bin/python |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
2 |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
3 import os |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
4 import ImageFont, ImageDraw, Image |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
5 |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
6 dir1 = "/data/lisa/data/ift6266h10/allfonts/" |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
7 #dir1 = "/Tmp/allfonts/" |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
8 |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
9 img = Image.new("L", (132,132)) |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
10 draw = ImageDraw.Draw(img) |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
11 L = [chr(ord('0')+x) for x in range(10)] + [chr(ord('A')+x) for x in range(26)] + [chr(ord('a')+x) for x in range(26)] |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
12 |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
13 for f in os.listdir(dir1): |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
14 try: |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
15 font = ImageFont.truetype(dir1+f, 25) |
142
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
16 for l in L: |
bb26c12bb9f6
Added other auxiliary files corruption tests
boulanni <nicolas_boulanger@hotmail.com>
parents:
135
diff
changeset
|
17 draw.text((60,60), l, font=font, fill="white") |
135
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
18 except: |
36010ff90255
Added script to test truetype font files validity (corruption)
boulanni <nicolas_boulanger@hotmail.com>
parents:
diff
changeset
|
19 print dir1+f |