On 19/09/2010 20:44, Sven Neumann wrote:

>
> First of all, why are you using the PDB directly instead of using the
> Python objects?

Ignorance, defiance, and laziness. The doc for the Image class 
(http://www.gimp.org/docs/python/index.html) has around 20 methods. 
Compare to the number of gimp_image_* functions in the PDB (not speaking 
of all the Python class methods/attributes vs the whole PDB)(*) For a 
newcomer, it looks like using the Python classes isn't going to cut it, 
since PDB functions will have to be used anyway, so why bother with two 
ways of doing things? And for the laziness bit, the python-fu console 
gives pre-cooked PDB calls...


> The code to create an image and an RGBA layer should
> look like this:
>
> image = image = gimp.Image(100, 100, RGB)
> layer = gimp.Layer(image, "RGB layer", 100, 100, RGBA_IMAGE)
> image.add_layer(layer)
>
> Then to address you problem, you are not really creating a grayscale
> layer in an RGB image. Your code only creates the layer, it doesn't
> actually add it to the image. If you tried to do that, then that would
> fail.

Indeed. Case closed :-)

(*) I'm not underestimating the challenge of having a complete Python 
"vision" of the PDB...

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to