def jpeg(self, ctx, image_source: converters.Image):
"""
Drastically lowers an image's quality.
This command takes an image, and saves it as a JPEG with the quality of 1.
"""
im_data = await get_bytesio(self.bot.session, image_source)
im = Image.open(im_data).convert('RGB')
with BytesIO() as output:
await ctx.bot.loop.run_in_executor(
None,
functools.partial(im.save, output, format='jpeg', quality=1)
)
output.seek(0)
await ctx.send(file=discord.File(output, filename='jpeg.jpg'))
im.close()
im_data.close()
评论列表
文章目录