Skip to content

Commit

Permalink
partial fix to #10
Browse files Browse the repository at this point in the history
  • Loading branch information
krishsharma0413 committed May 28, 2023
1 parent 0d89e4e commit 633c232
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions DiscordLevelingCard/discord_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async def _image(url:str):
return Image.open(BytesIO(data))


async def card1(self)-> Union[None, bytes]:
async def card1(self, resize: int = 100)-> Union[None, bytes]:
"""
Creates the rank card and returns `bytes`
Expand Down Expand Up @@ -171,12 +171,14 @@ async def card1(self)-> Union[None, bytes]:
self.background = new.resize((505, 259))

image = BytesIO()
if resize != 100:
self.background = self.background.resize((int(self.background.size[0]*(resize/100)), int(self.background.size[1]*(resize/100))))
self.background.save(image, 'PNG')
image.seek(0)
return image


async def card2(self)-> Union[None, bytes]:
async def card2(self, resize: int = 100)-> Union[None, bytes]:
"""
Creates the rank card and returns `bytes`
Expand Down Expand Up @@ -236,11 +238,13 @@ async def card2(self)-> Union[None, bytes]:
background.paste(im, (330, 235))

image = BytesIO()
if resize != 100:
background = background.resize((int(background.size[0]*(resize/100)), int(background.size[1]*(resize/100))))
background.save(image, 'PNG')
image.seek(0)
return image

async def card3(self)-> Union[None, bytes]:
async def card3(self, resize: int = 100)-> Union[None, bytes]:
"""
Creates the rank card and returns `bytes`
Expand Down Expand Up @@ -299,6 +303,8 @@ async def card3(self)-> Union[None, bytes]:
background.paste(im, (330, 235), im.convert("RGBA"))

image = BytesIO()
if resize != 100:
background = background.resize((int(background.size[0]*(resize/100)), int(background.size[1]*(resize/100))))
background.save(image, 'PNG')
image.seek(0)
return image

0 comments on commit 633c232

Please sign in to comment.