photos.py 文件源码

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

项目:danube-delta 作者: honzajavorek 项目源码 文件源码
def import_image(src_filename, dest_filename):
    if os.path.isfile(dest_filename):
        click.echo('Already exists, skipping: {}'.format(dest_filename))
    else:
        with Image.open(src_filename) as image:
            image.thumbnail((IMAGE_MAX_SIZE, IMAGE_MAX_SIZE))

            try:
                image.filter(ImageFilter.SHARPEN)
            except ValueError:
                pass  # skip filtering for images which do not support it

            click.echo('Saving: {}'.format(dest_filename))
            options = dict(IMAGE_SAVE_OPTIONS)
            if is_animated(image):
                options.setdefault('save_all', True)
            image.save(dest_filename, image.format, **options)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号