C API: array of floats/ints from python to C and back
fetchinson at googlemail.com
Sun Dec 28 01:44:27 CET 2008
>> I agree that array.array is more efficient than a list but the input
>> for my function will come from PIL and PIL returns a list. So I have a
>> list to begin with which will be passed to the C function.
> With recent versions of PIL, numpy can create an array from an Image very
> quickly, possibly without any copying of memory.
What exactly do you mean? (1) PIL creates a list which can be easily
converted by numpy to a numpy.array or (2) with the help of numpy one
can create a numpy.array from an image directly?
Since I will have to pass the list or numy.array to C anyway I don't
see any advantage to (1) although (2) can be useful.
Psss, psss, put it down! - http://www.cafepress.com/putitdown
More information about the Python-list