Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diamond = np.array([[ 0, 0, 0, 0, 255, 0, 0, 0, 0],
- [ 0, 0, 0, 255, 0, 255, 0, 0, 0],
- [ 0, 0, 255, 0, 0, 0, 255, 0, 0],
- [ 0, 255, 0, 0, 0, 0, 0, 255, 0],
- [255, 0, 0, 0, 0, 0, 0, 0, 255],
- [ 0, 255, 0, 0, 0, 0, 0, 255, 0],
- [ 0, 0, 255, 0, 0, 0, 255, 0, 0],
- [ 0, 0, 0, 255, 0, 255, 0, 0, 0],
- [ 0, 0, 0, 0, 255, 0, 0, 0, 0]], dtype=uint8)
- size = 36
- my_dpi = mpl.rcParams['figure.dpi']
- plt.subplots(figsize=(size/my_dpi, size/my_dpi))
- plt.axis('off')
- img = Image.fromarray(diamond, 'L')
- img.resize((size,size)).save('diamond.ppm')
- plt.imshow(img)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement