标签:audio class rgb pixel range file 宽度 bsp splay
注意图片像素返回值是(宽度,长度),pil填像素点坐标原点左上角。
import numpy as np from PIL import Image file = input() im = Image.open(file) R,C = im.size newR = R//3 newC = C//3 picls = [] for i in range(9): picls.append(Image.new(‘RGB‘, (newR, newC),(255,255,255))) cnt = 0 for i in range(3): for j in range(3): for x in range(i * newC, (i + 1) * newC): for y in range(j*newR,(j+1)*newR): r, g, b = im.getpixel((y, x)) picls[cnt].putpixel((y-(j*newR),x-i*newC),(r,g,b)) cnt+=1 for i in range(9): picls[i].save("".join(str(i))+".jpg")
标签:audio class rgb pixel range file 宽度 bsp splay
原文地址:https://www.cnblogs.com/TreeDream/p/9827637.html