webm.py 文件源码

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

项目:gallery 作者: liam-middlebrook 项目源码 文件源码
def generate_thumbnail(self):
        self.thumbnail_uuid = hash_file(self.file_path) + ".jpg"
        thumbnail_loc = os.path.join(self.dir_path, self.thumbnail_uuid)

        clip = VideoFileClip(self.file_path)
        time_mark = clip.duration * 0.05
        clip.save_frame(thumbnail_loc, t=time_mark)

        with Image(filename=thumbnail_loc) as img:
            with img.clone() as image:
                size = image.width if image.width < image.height else image.height
                image.crop(width=size, height=size, gravity='center')
                image.resize(256, 256)
                image.background_color = Color("#EEEEEE")
                image.format = 'jpeg'
                image.save(filename=thumbnail_loc)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号