Ask Your Question

Revision history [back]

Since PIL is included within Sage, you can do:

from PIL import Image
img = Image.open("your_file.png")

Then, you can do : list(img.getdata())

See img.<TAB> to see avbailable commands. If you prefer to deal with numpy arrays:

from numpy import array
arr = array(img)

Since PIL is included within Sage, you can do:

from PIL import Image
img = Image.open("your_file.png")

Then, you can do : do:

list(img.getdata())

list(img.getdata())

See img.<TAB> to see avbailable commands. If you prefer to deal with numpy arrays:

from numpy import array
arr = array(img)