import base64 if __name__ == "__main__": dir='image.jpg' basef=open(dir.split('.')[0]+'_base64.txt','w') with open (dir,'rb') as f: base64_data=base64.b64encode(f.read()) s=base64_data.decode() data='data:image/jpeg;base64,%s'%s # print(data) ba…
from scipy.misc import imread,imshow img = imread('D:test.bmp') print img[:,:,2].shape imshow() 注意img[:,:,2]的最后一个维度上的值最大为2,因为是RGB图像,最多是3个2维矩阵的叠加. print img1[:, :, 3] 会产生 IndexError: index 3 is out of bounds for axis 2 with size 3…