I want to upload an image from my computer, and get the corresponding pixel matrix. No idea how to start.
from PIL import Image im = Image.open('Saga.jpg') pixelMap = im.load() img = Image.new( im.mode, im.size) pixelsNew = img.load() for i in range(img.size): for j in range(img.size): # your code here img.show()
pixelsNew is an
N by 1 matrix, but it gets you the pixel data which you can then put it in whatever sized matrix you want.