1>>> face_memmap = np.memmap('face.raw', dtype=np.uint8, shape=(768, 1024, 3))
2
1>>> from scipy import misc
2>>> import imageio
3>>> face = misc.face()
4>>> imageio.imsave('face.png', face) # First we need to create the PNG file
5
6>>> face = imageio.imread('face.png')
7>>> type(face)
8<class 'imageio.core.util.Array'>
9>>> face.shape, face.dtype
10((768, 1024, 3), dtype('uint8'))
11
1>>> face.tofile('face.raw') # Create raw file
2>>> face_from_raw = np.fromfile('face.raw', dtype=np.uint8)
3>>> face_from_raw.shape
4(2359296,)
5>>> face_from_raw.shape = (768, 1024, 3)
6