@@ -31,6 +31,7 @@ def create(player, cards=None, cardinfo=None):
3131 cardinfo [player ['color' ]]['width' ],
3232 cardinfo [player ['color' ]]['position' ] + cardinfo [player ['color' ]]['height' ]
3333 ))
34+
3435 card = Image .new ("RGB" , cardbg .size , (29 , 147 , 171 ))
3536 card .paste (cardbg , cardbg )
3637
@@ -39,32 +40,32 @@ def create(player, cards=None, cardinfo=None):
3940 r = requests .get (player ['specialImages' ]['largeTOTWImgUrl' ])
4041 else :
4142 r = requests .get (player ['headshot' ]['largeImgUrl' ])
42- headshot = Image .open (BytesIO (r .content ))
43- card .paste (headshot , (cardinfo [player ['color' ]]['width' ]- headshot .size [1 ]- 3 , 40 ), headshot )
43+ headshot = Image .open (BytesIO (r .content )). convert ( 'RGBA' )
44+ card .paste (headshot , (cardinfo [player ['color' ]]['width' ]- headshot .size [1 ]- 7 , 40 ), headshot )
4445
4546 # Rating
4647 renderedSize = _font25 .getsize (str (player ['rating' ]))
4748 rating = Image .new ('RGBA' , renderedSize , (255 , 255 , 255 , 0 ))
4849 d = ImageDraw .Draw (rating )
4950 d .text ((0 , 0 ), str (player ['rating' ]), font = _font25 , fill = (54 , 33 , 27 , 255 ))
50- card .paste (rating , (45 , 20 ), rating )
51+ card .paste (rating , (42 , 30 ), rating )
5152
5253 # Position
5354 renderedSize = _font25 .getsize (str (player ['position' ]))
5455 position = Image .new ('RGBA' , renderedSize , (255 , 255 , 255 , 0 ))
5556 d = ImageDraw .Draw (position )
5657 d .text ((0 , 0 ), str (player ['position' ]), font = _font16 , fill = (54 , 33 , 27 , 255 ))
57- card .paste (position , (45 , 50 ), position )
58+ card .paste (position , (42 , 60 ), position )
5859
5960 # club image
6061 r = requests .get (player ['club' ]['imageUrls' ]['normal' ]['large' ])
61- club = Image .open (BytesIO (r .content ))
62- card .paste (club , (38 , 76 ), club )
62+ club = Image .open (BytesIO (r .content )). convert ( 'RGBA' )
63+ card .paste (club , (35 , 85 ), club )
6364
6465 # nation image
6566 r = requests .get (player ['nation' ]['imageUrls' ]['large' ])
66- nation = Image .open (BytesIO (r .content ))
67- card .paste (nation , (38 , 123 ), nation )
67+ nation = Image .open (BytesIO (r .content )). convert ( 'RGBA' )
68+ card .paste (nation , (35 , 130 ), nation )
6869
6970 if player ['color' ][0 :3 ] == 'tot' :
7071 fillColor = (255 , 234 , 128 , 255 )
0 commit comments