I want to import an image and the store all the pixel values in an array. How can I do this ?
This is what I have tried already but the array is wrong.
from PIL import Image
im = Image.open('red-flower.jpg', 'r')
pix_val = list(im.getdata())
You have the parameters wrong for Image.open():
import numpy as np
from PIL import Image
im = Image.open('red-flower.jpg')
array = np.array(im)
Documentation here.
numpy.array(im.getdata())?