You are here

Loading an image as a layer

I just finished writing a python script that takes a picture from the webcam, saves it to /tmp/ then loads it as a layer. The webcam picture taking and saving works fine but the python script won't load the image back into gimp as a layer. When the script is run, there's a progress bar that says it's loading the image but after nothing so I think I'm using the wrong subroutine to put the loaded layer onto the image. Here is the code:

As you could probably see, saving an image and then reloading it is a useless file operation, but I don't know how to convert Python Image Library files into gimp layers. Also, the code is really sloppy and I'll fix it later :P

maybe a "display layer " command is missed ?

and the procedure for display layer would be...

add a 'gimp-image-add-layer' step

I have one at line 22
"pdb.gimp_image_add_layer(image, layer, (0,0))"

I have one at line 22
"pdb.gimp_image_add_layer(image, layer, (0,0))"

Your use of "(0,0)" is incorrect. The argument is not an XY position, but a layerstack position. Layerstack positions are numbered 0 to N from top to bottom. "0" is the topmost layer, "1" is the next layer down, and so on.
If you pass a value of "-1" then the layer will be positioned directly above the active layer.

thank you very much, it works now :D

Subscribe to Comments for "Loading an image as a layer"