On 9/2/11 12:33 AM, Ingo Randolf wrote:
i get the RGBA-list from within blender...
ouch! I'm still amazed when folks write wrappers that use lists of
numbers for large arrays of data -- it's simple NOT the way to go --
painfully slow and memory inefficient. This is what the PEP 3118 buffer
protocol is for -- I know it's new, but I sure wish folks would use it.
Does Blender not provide a way to get some sort of efficient image
object? in this case, you may even get better performance writing an
image to file, and reading it back in with PIL.
right now i have troubles getting numpy working in blenders bundled python
(3.2)... so i could not try this proposal...
what was the problem? a simple "setup.py install" should work fine.
making tuples out of the list (either with or without value-scaling) is too
slow...
did you try making an array.array object? That's in the stdlib at least,
though the scaling will be slower than numpy
-Chris
ingo
Am 31.08.2011 um 20:51 schrieb Chris.Barker:
On 8/31/11 9:27 AM, Christoph Gohlke wrote:
On 8/31/2011 7:21 AM, Ingo Randolf wrote:
I have a list with float-values describing an image like this:
[R, G, B, A, R, G, B, A, R, G, B, A, R, G, B, A, R, G, B, A, ... etc.]
I can't help but wonder why it's in that data structure to begin with -- as
you've seen, it's a pretty painfully inefficient way to do it.
i played around with putdata...
you need it in a binary format that is compatible:
Consider using numpy<http://numpy.scipy.org/> and Image.fromarray.
this is probably the best way, but you can also use an array.array object --
create an array.array of type byte from your list, then pass that in to
putdata. (details left as an exercise for the reader)
I think working with numbers in Python without numpy would be like working with
text using lists of characters, rather than the string object.
-Chris
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig
--
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.bar...@noaa.gov
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig