Mercurial > ift6266
diff data_generation/transformations/ttf2jpg.py @ 273:7800be7bce66
changes in ttf2jpg and pycaptcha to load a file list with cPickle (instead of doing a listdir()) in order to have always the same list order from different machine (to reproduce generation)
author | Xavier Glorot <glorotxa@iro.umontreal.ca> |
---|---|
date | Sun, 21 Mar 2010 16:45:48 -0400 |
parents | 1f5937e9e530 |
children |
line wrap: on
line diff
--- a/data_generation/transformations/ttf2jpg.py Wed Mar 17 16:41:51 2010 -0400 +++ b/data_generation/transformations/ttf2jpg.py Sun Mar 21 16:45:48 2010 -0400 @@ -10,6 +10,7 @@ import sys, os, fnmatch, random import Image, ImageFont, ImageDraw, numpy +import cPickle class ttf2jpg(): def __init__(self, font_file = ''): @@ -26,8 +27,9 @@ self.char_list.append(chr(ord('A') + i) ) for i in range(0,26): self.char_list.append(chr(ord('a') + i) ) - files = os.listdir(self.font_dir) - self.font_files = fnmatch.filter(files, '*.ttf') + fnmatch.filter(files, '*.TTF') + f = open( self.font_dir + 'filelist.pkl' ,'r') + self.font_files = cPickle.load(f) + f.close() # get font name def get_settings_names(self):