memes.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:dogbot 作者: slice 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号