Skip to content

Instantly share code, notes, and snippets.

@mattfoster
Created August 11, 2008 12:39
Show Gist options
  • Save mattfoster/4855 to your computer and use it in GitHub Desktop.
Save mattfoster/4855 to your computer and use it in GitHub Desktop.
Methods for converting between numpy arrays and PIL images. Very useful
import numpy, Image
i = Image.open('lena.jpg')
a = numpy.asarray(i) # a is readonly
i = Image.fromarray(a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment