EXIF.py 文件源码

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

项目:pythonista-toys 作者: Wildog 项目源码 文件源码
def get_histogram(img):
    if not img.mode.startswith('RGB'):
        img = img.convert('RGB')
    hist = img.histogram()
    max_h = float(max(hist))
    height = 180
    with ui.ImageContext(430, height) as ctx:
        a = 1
        rgb = [(1, 0, 0, a), (0, 1, 0, a), (0, 0, 1, a)]
        for i, color in enumerate(rgb):
            ui.set_color(color)
            for j, count in enumerate(hist[i*256:i*256+256]):
                bar_height = count / max_h * (height - 5)
                ui.fill_rect(2*j, height-bar_height, 2, bar_height)
        return ctx.get_image()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号