image_sequence.py 文件源码

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

项目:BiblioPixel2 作者: ManiacalLabs 项目源码 文件源码
def update(self, data):
        map = self.matrix_map
        size = self._pixelSize
        img = Image.new("RGB", (self.width * size, self.height * size), None)
        draw = ImageDraw.Draw(img)
        for x in range(self.width):
            for y in range(self.height):
                if map:
                    i = map[y][x]
                else:
                    i = x
                rgb = tuple(data[i * 3:i * 3 + 3])
                draw.rectangle([x * size, y * size, x * size +
                                size - 1, y * size + size - 1], rgb, rgb)

        self._images.append(img)

    # use ImageMagick to combine and make the gif
    # convert -delay 25 -loop 0 *.png 0.gif
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号