How to convert between NumPy array and PIL Image Ashwin Uncategorized January 16, 2014January 16, 2014 0 Minutes Converting a single channel PIL Image to a 1-D NumPy array and back is easy: 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) Tried with: Python 2.7.3 and Ubuntu 12.04 Advertisements Share this:PocketFacebookTwitterLinkedInEmailLike this:Like Loading... Related Published by Ashwin View all posts by Ashwin Published January 16, 2014January 16, 2014

I am working on Python project involving Tkinter and OpenCV. I stumbled on this trick you used. Thank you very much for sharing. LikeLike Reply

if i have matrix of [14965,16,32,256] where 14965 is the number of images. I want to save every image in jpg formate to use it in another project, How can i do this? LikeLike Reply

I am working on Python project involving Tkinter and OpenCV. I stumbled on this trick you used. Thank you very much for sharing.

LikeLike

if i have matrix of [14965,16,32,256] where 14965 is the number of images. I want to save every image in jpg formate to use it in another project, How can i do this?

LikeLike