annotate data_generation/transformations/ttf2jpg.py @ 299:a9af079892ce

branch merge
author Arnaud Bergeron <abergeron@gmail.com>
date Mon, 29 Mar 2010 17:42:44 -0400
parents 7800be7bce66
children
rev   line source
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
1 #!/usr/bin/python
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
2 # -*- coding: iso-8859-1 -*-
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
3
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
4 '''
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
5 Implementation of font image generator
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
6 download fonts from http://www.dafont.com for exemple
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
7
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
8 Author: Guillaume Sicard
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
9 '''
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
10
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
11 import sys, os, fnmatch, random
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
12 import Image, ImageFont, ImageDraw, numpy
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)
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 167
diff changeset
13 import cPickle
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
14
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
15 class ttf2jpg():
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
16 def __init__(self, font_file = ''):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
17 self.w = 32
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
18 self.h = 32
133
a4e5128ef2cb Adapted ttf2jpg to get fonts in /Tmp/allfonts local folder
boulanni <nicolas_boulanger@hotmail.com>
parents: 109
diff changeset
19 self.font_dir = '/Tmp/allfonts/'
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
20 self.font_file = font_file
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
21 self.image_dir = './images/'
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
22 self.pattern = '*.ttf'
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
23 self.char_list = []
109
9c45e0071b52 Adapté le générateur d'images de fontes pour utiliser en amont du pipeline
boulanni <nicolas_boulanger@hotmail.com>
parents: 43
diff changeset
24 for i in range(0,10):
9c45e0071b52 Adapté le générateur d'images de fontes pour utiliser en amont du pipeline
boulanni <nicolas_boulanger@hotmail.com>
parents: 43
diff changeset
25 self.char_list.append(chr(ord('0') + i) )
9c45e0071b52 Adapté le générateur d'images de fontes pour utiliser en amont du pipeline
boulanni <nicolas_boulanger@hotmail.com>
parents: 43
diff changeset
26 for i in range(0,26):
9c45e0071b52 Adapté le générateur d'images de fontes pour utiliser en amont du pipeline
boulanni <nicolas_boulanger@hotmail.com>
parents: 43
diff changeset
27 self.char_list.append(chr(ord('A') + i) )
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
28 for i in range(0,26):
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
29 self.char_list.append(chr(ord('a') + i) )
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)
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 167
diff changeset
30 f = open( self.font_dir + 'filelist.pkl' ,'r')
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)
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 167
diff changeset
31 self.font_files = cPickle.load(f)
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)
Xavier Glorot <glorotxa@iro.umontreal.ca>
parents: 167
diff changeset
32 f.close()
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
33
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
34 # get font name
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
35 def get_settings_names(self):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
36 return [self.font_file]
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
37
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
38 # save an image
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
39 def save_image(self,array, filename = ''):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
40 image = (array * 255.0).astype('int')
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
41 image = Image.fromarray(image).convert('L')
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
42 if (filename != ''):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
43 image.save(filename)
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
44 else:
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
45 image.show()
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
46
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
47 # set a random font for character generation
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
48 def set_random_font(self):
133
a4e5128ef2cb Adapted ttf2jpg to get fonts in /Tmp/allfonts local folder
boulanni <nicolas_boulanger@hotmail.com>
parents: 109
diff changeset
49 i = random.randint(0, len(self.font_files) - 1)
a4e5128ef2cb Adapted ttf2jpg to get fonts in /Tmp/allfonts local folder
boulanni <nicolas_boulanger@hotmail.com>
parents: 109
diff changeset
50 self.font_file = self.font_dir + self.font_files[i]
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
51
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
52 # return a picture array of "text" with font "font_file"
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
53 def create_image(self, text):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
54 # create a w x h black picture, and a drawing space
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
55 image = Image.new('L', (self.w, self.h), 'Black')
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
56 draw = ImageDraw.Draw(image)
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
57
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
58 # load the font with the right size
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
59 font = ImageFont.truetype(self.font_file, 28)
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
60 d_w,d_h = draw.textsize(text, font=font)
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
61
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
62 # write text and aligns it
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
63 draw.text(((32 - d_w) / 2, ((32 - d_h) / 2)), text, font=font, fill='White')
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
64
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
65 image = numpy.asarray(image)
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
66 image = (image / 255.0).astype(numpy.float32)
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
67
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
68 return image
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
69
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
70 # write all the letters and numbers into pictures
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
71 def process_font(self):
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
72 for i in range(0, len(self.char_list) ):
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
73 image = self.create_image(self.char_list[i])
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
74 self.save_image(image, self.image_dir + self.char_list[i] + '-' + os.path.basename(self.font_file) + '.jpg')
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
75 sys.stdout.write('.')
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
76 sys.stdout.flush()
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
77 return (len(self.char_list))
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
78
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
79 # generate the character from the font_file and returns a numpy array
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
80 def generate_image_from_char(self, character, font_file = ''):
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
81 if (font_file != ''):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
82 self.font_file = font_file
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
83
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
84 return self.create_image(character)
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
85
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
86 # generate random character from random font file as a numpy array
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
87 def generate_image(self):
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
88 self.set_random_font()
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
89 i = random.randint(0, len(self.char_list) - 1)
109
9c45e0071b52 Adapté le générateur d'images de fontes pour utiliser en amont du pipeline
boulanni <nicolas_boulanger@hotmail.com>
parents: 43
diff changeset
90 return self.generate_image_from_char(self.char_list[i]), i
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
91
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
92 # test method, create character images for all fonts in "font_dir" in dir "image_dir"
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
93 def test(self):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
94 import time
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
95
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
96 # look for ttf files
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
97 files = os.listdir(self.font_dir)
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
98 font_files = fnmatch.filter(files, self.pattern)
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
99
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
100 # create "image_dir" if it doesn't exist
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
101 if not os.path.isdir(self.image_dir):
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
102 os.mkdir(self.image_dir)
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
103
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
104 sys.stdout.write( str(len(font_files)) + ' fonts found, generating jpg images in folder ' + self.image_dir )
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
105 sys.stdout.flush()
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
106
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
107 # main loop
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
108 t = time.time()
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
109 n = 0
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
110
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
111 for font_file in font_files:
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
112 self.font_file = self.font_dir + font_file
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
113 n += self.process_font()
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
114 t = time.time() - t
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
115
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
116 sys.stdout.write('\nall done!\n' + str(n) + ' images generated in ' + str(t) + 's (average : ' + str(1000 * t / n) + ' ms/im)\n')
6
424b5b0d9fcb Image generation from fonts added
guitch
parents:
diff changeset
117
33
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
118 if __name__ == '__main__':
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
119
6d432a5010a2 Modified font generator script : module creation. Not fully compliant with testmod.py though (transformation != generation)
Guillaume Sicard <guitch21@gmail.com>
parents: 6
diff changeset
120 myttf2jpg = ttf2jpg()
43
05145f4fb609 Added : generation of random character with random font file from a specified folder
Guillaume Sicard <guitch21@gmail.com>
parents: 33
diff changeset
121 #myttf2jpg.test()
109
9c45e0071b52 Adapté le générateur d'images de fontes pour utiliser en amont du pipeline
boulanni <nicolas_boulanger@hotmail.com>
parents: 43
diff changeset
122 image, i = myttf2jpg.generate_image()
9c45e0071b52 Adapté le générateur d'images de fontes pour utiliser en amont du pipeline
boulanni <nicolas_boulanger@hotmail.com>
parents: 43
diff changeset
123 myttf2jpg.save_image(image, '')