24色卡图-Python
用Python生成一个24色卡图
24色卡对应的值如下:
[115, 82, 69],
[204, 161, 141],
[101, 134, 179],
[89, 109, 61],
[141,137,194],
[132,228,208],
[249,118,35],
[80,91,182],
[222,91,125],
[91,63,123],
[173,232,91],
[255,164,26],
[44,56,142],
[74,148,81],
[179,42,50],
[250,226,21],
[191,81,160],
[6,142,172],
[252,252,252],
[230,230,230],
[200,200,200],
[143,143,142],
[100,100,100],
[50,50,50]
代码
import numpy as np
import matplotlib.pyplot as plt
import skimage.io as io
list1 = [[115, 82, 69], [204, 161, 141], [101, 134, 179], [89, 109, 61], [141,137,194],
[132,228,208], [249,118,35], [80,91,182], [222,91,125], [91,63,123], [173,232,91],
[255,164,26], [44,56,142], [74,148,81], [179,42,50], [250,226,21], [191,81,160],
[6,142,172], [252,252,252], [230,230,230], [200,200,200], [143,143,142], [100,100,100], [50,50,50]]
b = np.array(list1)
image = np.zeros((4*150+5*20, 6*150+7*20, 3))
for i in range(4):
for j in range(6):
image[20+i*170: 20+i*170+150, 20+j*170:20+j*170+150, :] = b[i*6+j, :]
image = image.astype(int)
plt.imshow(image)
plt.axis("off")
io.imsave('24colormap.jpg', image)