[Image-SIG] Is getdata() or load() more efficient for accessing pixels?

Christopher Barker Chris.Barker at noaa.gov
Wed Dec 5 18:50:45 CET 2007


jorma kala wrote:
> I read that the getpixel function of the PIL library is relatively slow.

Depending on your needs, numpy may be a good bet:

http://jehiah.cz/archive/creating-images-with-numpy

Be sure to look at the comment below, demonstrating the new 
Image.fromarray() function.

And you can convert a PIL image to a numpy array with no data copying:

arr = numpy.asarray(PIL_image)

-CHB

-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov


More information about the Image-SIG mailing list