image_handler.py 文件源码

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

项目:cps2-gfx-editor 作者: goosechooser 项目源码 文件源码
def _condense(img):
    """PNG image is returned as 3 bands representing RGB on each plane.
    Flattens into 1 plane array with each (R,G,B) value represented as RGB.

    """
    im = [band.tobytes() for band in img.split()]
    band_fmt = 'c'
    band_iter = [struct.iter_unpack(band_fmt, split_im) for split_im in im]
    comb = []

    for val in band_iter[0]:
        val_2 = next(band_iter[1])
        val_3 = next(band_iter[2])
        comb.append(b''.join([*val, *val_2, *val_3]))

    return comb
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号