Created
July 18, 2017 00:23
-
-
Save gavinmh/6b5f88c440f029017809bd3988582ae9 to your computer and use it in GitHub Desktop.
PIL to NumPy to PIL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import PIL | |
# Convert Image to array | |
img = PIL.Image.open("foo.jpg").convert("L") | |
arr = numpy.array(img) | |
# Convert array to Image | |
img = PIL.Image.fromarray(arr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment