【问题标题】:discord.py Pillow train meme command text overlappingdiscord.py Pillow train meme 命令文本重叠
【发布时间】:2021-04-16 21:34:22
【问题描述】:

因此,每当我尝试执行此命令时,它都会成功运行,但文本会覆盖而不是在其上粘贴空的火车模因模板

@client.command()
async def trainmeme(ctx, *, text):
  text = text.split(",")
  text2 = text[0]
  text3 = text[1]
  img = Image.open("train.jpg")
  draw = ImageDraw.Draw(img)
  drawer = ImageDraw.Draw(img)
  font = ImageFont.truetype("Arimo.ttf", 50)
  drawer.text((197, 165), text=text2, font=font)
  draw.text((87, 531), text=text3, font=font)
  img.save("train.jpg")
  img.paste(img, (7, 5))
  await ctx.send(file = discord.File("train.jpg"))

这是我尝试多次执行该命令时发生的情况的图片

【问题讨论】:

标签: python discord python-imaging-library


【解决方案1】:

这是因为您使用的是img.save("train.jpg"),它会覆盖原始图像文件。

【讨论】:

    猜你喜欢
    • 2021-08-28
    • 2019-07-30
    • 2021-07-05
    • 1970-01-01
    • 2021-07-27
    • 2020-11-24
    • 2021-07-10
    • 2021-08-17
    • 2021-06-15
    相关资源
    最近更新 更多