1313intY = 436 - 64
1414
1515objImages = [ {
16- 'strFile' : 'official - caffe.png' ,
17- 'strText' : 'official - Caffe'
16+ 'strFile' : 'official - caffe.png' ,
17+ 'strText' : 'official - Caffe'
1818}, {
19- 'strFile' : 'this - pytorch.png' ,
20- 'strText' : 'this - PyTorch'
19+ 'strFile' : 'this - pytorch.png' ,
20+ 'strText' : 'this - PyTorch'
2121} ]
2222
2323npyImages = []
2424
2525for objImage in objImages :
26- objOutput = PIL .Image .open (objImage ['strFile' ]).convert ('RGB' )
26+ objOutput = PIL .Image .open (objImage ['strFile' ]).convert ('RGB' )
2727
28- for intU in [ intShift - 10 for intShift in range (20 ) ]:
29- for intV in [ intShift - 10 for intShift in range (20 ) ]:
30- if math .sqrt (math .pow (intU , 2.0 ) + math .pow (intV , 2.0 )) <= 5.0 :
31- PIL .ImageDraw .Draw (objOutput ).text ((intX + intU , intY + intV ), objImage ['strText' ], (255 , 255 , 255 ), PIL .ImageFont .truetype ('freefont/FreeSerifBold.ttf' , 32 ))
32- # end
33- # end
34- # end
28+ for intU in [ intShift - 10 for intShift in range (20 ) ]:
29+ for intV in [ intShift - 10 for intShift in range (20 ) ]:
30+ if math .sqrt (math .pow (intU , 2.0 ) + math .pow (intV , 2.0 )) <= 5.0 :
31+ PIL .ImageDraw .Draw (objOutput ).text ((intX + intU , intY + intV ), objImage ['strText' ], (255 , 255 , 255 ), PIL .ImageFont .truetype ('freefont/FreeSerifBold.ttf' , 32 ))
32+ # end
33+ # end
34+ # end
3535
36- PIL .ImageDraw .Draw (objOutput ).text ((intX , intY ), objImage ['strText' ], (0 , 0 , 0 ), PIL .ImageFont .truetype ('freefont/FreeSerifBold.ttf' , 32 ))
36+ PIL .ImageDraw .Draw (objOutput ).text ((intX , intY ), objImage ['strText' ], (0 , 0 , 0 ), PIL .ImageFont .truetype ('freefont/FreeSerifBold.ttf' , 32 ))
3737
38- npyImages .append (numpy .array (objOutput ))
38+ npyImages .append (numpy .array (objOutput ))
3939# end
4040
4141moviepy .editor .ImageSequenceClip (sequence = npyImages , fps = 1 ).write_gif (filename = 'comparison.gif' , program = 'ImageMagick' , opt = 'optimizeplus' )
0 commit comments