[Bf-python] Image.getPixelColor

Austin Benesh bfdeveloper at gmail.com
Sat Apr 30 18:57:21 CEST 2005


I have never used the PIL, but it does sound like it would be a useful
integration. Unfortunately, my current code is still in its infancy (ask
Steven) and more than likely will not be in the next release. PIL is a
subject that will need some further consideration, seeing as how that would
be a huge undertaking to implement. Here are my plans for the internal
Blender-Python image library:

getPixelColors(i x, i y) ; needs some serious reconstruction
getMaxXY() ; same as above
getMinXY() ; not written yet
setPixelColors(i x, i y, [fr,fb,fg,fa]) ; not written-requires the next one
saveImage(c* file) ; this will be a monster to write

That's not all, just what I could come up with for now. If you have any more
ideas, please tell me. One thing to keep in mind, however, is that we're not
trying to turn Blender into the next Gimp ;). I'm simply trying to help
those who feel they should control their images much better.

-- Austin
-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Jonathan
Merritt
Sent: Friday, April 29, 2005 11:33 PM
To: Blender Foundation Python list
Subject: Re: [Bf-python] Image.getPixelColor

Hi Austin,

This sounds like great work. :-)  I've also been wondering if some kind
of inter-operability could be achieved between Blender Images and Python
Imaging Library (PIL) images.  Many people working with images and
Python will be familiar with PIL.  It can achieve many things that will
probably always be beyond the scope of Blender's image API.

I was wondering if you knew of any inter-operability issues that might
be addressed while you're working on your current code?  Perhaps
following PIL conventions for certain things?  (I'm not sure what
conventions should be taken into account; that's why I'm asking if
you've looked into it. :-)

Obviously Blender needs its own internal binary representation of an
image, but it would be nice if there were some kind of
(semi-)transparent way of using PIL images or the data they contain. 
Maybe this could be done using the Python sequence protocol as an
intermediary?  What do people think?

What I have in my head here is the easy cooperation that exists between
normal Python lists of floats or integers, and numarray arrays (
numeric.scipy.org ).  I think it would be great if we had a similar easy
level of interchange between PIL and Blender.

Jonathan Merritt.


Austin Benesh wrote:

>Ok, the documentation is up and the first patch can be trashed.
>The new patches:
>
>getpixels.diff
>imagedoc_update.diff
>
>Here's what I fixed:
>
>- stupid comments
>- patch not working
>- Max_xy is now MaxXY
>- extra debug code and junk like that
>
>Here's what I still need to add:
>
>- getMinXY
>- setPixelColor (might require an Image.save())
>- any additional operations
>
>Please say if there is anything more that may need fixing or adding.
>  
>
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python




More information about the Bf-python mailing list