Re: Optimizing numpy

2007-05-12 Thread sturlamolden
On May 12, 10:52 pm, Gerdus van Zyl <[EMAIL PROTECTED]> wrote: > I have the following, that is used to convert pixel data and thus > should be as fast as possible: > > b = numpy.ndarray (shape=(w,h,4), dtype=numpy.uint8) > > a = numpy.frombuffer(buf, numpy.uint8) > a.shape = (w, h, 3) > > b[:,:,0]

Optimizing numpy

2007-05-12 Thread Gerdus van Zyl
I have the following, that is used to convert pixel data and thus should be as fast as possible: b = numpy.ndarray (shape=(w,h,4), dtype=numpy.uint8) a = numpy.frombuffer(buf, numpy.uint8) a.shape = (w, h, 3) b[:,:,0] = a[:,:,2] b[:,:,1] = a[:,:,1] b[:,:,2] = a[:,:,0] b[:,:,3] = 255 Can anyone