mobi.py 文件源码

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

项目:kmanga 作者: aplanas 项目源码 文件源码
def filter_margin(self, img):
        """Filter to remove empty margins in an image."""
        # This filter is based on a simple Gaussian with a threshold
        _img = ImageOps.invert(img.convert(mode='L'))
        _img = _img.filter(ImageFilter.GaussianBlur(radius=3))
        _img = _img.point(lambda x: (x >= 16) and x)
        # If the image is white, we do not have bbox
        return img.crop(self.bbox(_img)) if _img.getbbox() else img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号