I have about 200 grayscale PNG images stored within a directory like this.
1.png 2.png 3.png ... ... 200.png
I want to import all the PNG i
This can also be done with the Image class of the PIL library:
Image
from PIL import Image import numpy as np im_frame = Image.open(path_to_file + 'file.png') np_frame = np.array(im_frame.getdata())
Note: The .getdata() might not be needed - np.array(im_frame) should also work
.getdata()
np.array(im_frame)