Python写/读rgb图像

问题描述 投票:0回答:1

我已经测试过使用Image写入和读取一个像素的jpg文件:

data_ori = np.zeros((1, 1, 3), dtype=np.uint8)
data_ori[0,0]=(1,20,300)
img = Image.fromarray(data_ori, 'RGB')
img.save("toto2.jpg")
im = Image.open("toto2.jpg")
pix = im.load()

print(pix [0,0])给出(2,20,44)。有没有人有想法?

python image rgb
1个回答
0
投票

@Aran-Fey使用gif格式效果很好

© www.soinside.com 2019 - 2024. All rights reserved.