[Gimp-developer] gimp_drawable_get_image fails?
saulgoode at flashingtwelve.brickfilms.com
saulgoode at flashingtwelve.brickfilms.com
Fri Apr 13 14:27:37 PDT 2007
Quoting coolhand <a6intruder at mixmail.com>:
> The problem is that when i open the first image, then close it and then i
> open the second, gimp_drawable_get_image returns me -1. ¿Why this?
> Ok, sorry. I have to read a new format of image. This images have X layers.
>
> 1) I create one image: image = gimp_image_new (50, 50, GIMP_GRAY);
> 2) I read the layers one by one, and associate with this new image:
> gimp_image_add_layer (image, band[i].layer_id, i);
>
> I open one image and then close it (don't quit gimp, only close the image).
> If i open other image with my plugin, if in some place of my code i want to
> obtain what image ID have some layer with
> image_id = gimp_drawable_get_image (gimp_layerID);
>
> gimp says me that this layer don't have image (image_id = -1).
I may be misunderstanding you but it sounds as though you are trying
take a layer from one image and add it to another image directly. You
actually have to create a duplicate of the original layer (using
'gimp-layer-new-from-drawable') and then add the duplicate to your
destination.
Since just transferring a layer from one image to another should
result in a PDB error, I suspect that I may have completely
misinterpreted your steps (perhaps you could provide the full code).
More information about the Gimp-developer
mailing list