[Image-SIG] float rgba list -> Image
ingo at quitch.net
Fri Sep 2 09:33:26 CEST 2011
Thanks for all the answers...
i get the RGBA-list from within blender... loading an image or movie is stored in blender in this format and is accessible via python...
my idea (still) is to have a bridge from blender image-representation to PIL. this would enable to make image-transformations from within blender...
the problem i have right now, is that i want to align all the images in a movie in a taxture-atlas... i think this could be done easily with PIL...
it seems reading pixel-values is very slow in blender though...
right now i have troubles getting numpy working in blenders bundled python (3.2)... so i could not try this proposal...
making tuples out of the list (either with or without value-scaling) is too slow...
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.
More information about the Image-SIG