On Sat, 2010-09-18 at 21:55 +0200, Ofnuts wrote:

> > If that is the case, then there is a bug somewhere. But I very much
> > doubt that gray-scale layers are reported to have 3 or channels. Perhaps
> > you can show us some example code?
> >
> 
> Hmm. Wrote some fresh code to demonstrate this and of course it behaves 
> as you say. Grumble, grumble. Back to the drawing board. Thx for the 
> heads up.
> 
> PS: well, something fishy still.  Creating a greyscale layer in a RGB 
> image works, and yields a 1BPP layer:
> 
> image_color = pdb.gimp_image_new(100,100,0)
> layer_grayscale=pdb.gimp_layer_new(image_color,100,100,2,'grayscale_layer',100,0)
> print pdb.gimp_drawable_get_pixel(layer_grayscale,0,0)

First of all, why are you using the PDB directly instead of using the
Python objects? 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.


Sven


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

Reply via email to