9951 explained code solutions for 126 technologies


python-pillowHow to get array from image


from PIL import Image
import numpy as np

im = Image.open('/var/www/examples/heroine.png')
data = np.asarray(im)ctrl + c
PIL

import Pillow package modules

import numpy as np

load Numpy module for Python

Image.open

open given image with Pillow

/var/www/examples/heroine.png

path to sample image to open

np.asarray

converts given im image to array