RSS/Atom feed Twitter
Site is read-only, email is disabled

gimp_drawable_get_image fails?

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

8 of 8 messages available
Toggle history

Please log in to manage your subscriptions.

gimp_drawable_get_image fails? coolhand 12 Apr 13:34
  gimp_drawable_get_image fails? Sven Neumann 12 Apr 20:35
   gimp_drawable_get_image fails? coolhand 13 Apr 10:56
    gimp_drawable_get_image fails? saulgoode@flashingtwelve.brickfilms.com 13 Apr 23:27
     gimp_drawable_get_image fails? coolhand 16 Apr 11:55
      gimp_drawable_get_image fails? saulgoode@flashingtwelve.brickfilms.com 16 Apr 15:16
       gimp_drawable_get_image fails? coolhand 17 Apr 10:32
       gimp_drawable_get_image fails? Sven Neumann 17 Apr 20:54
coolhand
2007-04-12 13:34:42 UTC (about 17 years ago)

gimp_drawable_get_image fails?

When i open an image of my format, I create an multiple-layer image. With this image, i work normally. If i open other image of this format, i can work normally with both images.

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?

Sven Neumann
2007-04-12 20:35:47 UTC (about 17 years ago)

gimp_drawable_get_image fails?

Hi,

On Thu, 2007-04-12 at 04:34 -0700, coolhand wrote:

When i open an image of my format, I create an multiple-layer image. With this image, i work normally. If i open other image of this format, i can work normally with both images.

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?

We would like to help you but I don't see how we could possibly do that with the information that you provide. Please, when asking such questions, try to include the relevant code snippets or take your time to explain your problem in more detail.

Sven

coolhand
2007-04-13 10:56:01 UTC (about 17 years ago)

gimp_drawable_get_image fails?

Hi,

On Thu, 2007-04-12 at 04:34 -0700, coolhand wrote:

When i open an image of my format, I create an multiple-layer image. With this image, i work normally. If i open other image of this format, i can work normally with both images.

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?

We would like to help you but I don't see how we could possibly do that with the information that you provide. Please, when asking such questions, try to include the relevant code snippets or take your time to explain your problem in more detail.

Sven

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).

When i open two images, not closing the first, both opened, it works fine. ¿I have mistaken in somewhere? ¿There are to delete all layers before close the image or gimp makes it?

saulgoode@flashingtwelve.brickfilms.com
2007-04-13 23:27:37 UTC (about 17 years ago)

gimp_drawable_get_image fails?

Quoting coolhand :

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).

coolhand
2007-04-16 11:55:52 UTC (about 17 years ago)

gimp_drawable_get_image fails?

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.

Oh, no!. There are different layers created for different images. The problem comes when i close the first image, and open a new image; then i create this new image, create the new layers and associate these new layers to the new image, but when i try to get the image ID from one of these new layers, it returns -1. If i don't close the first image it works fine (with both images opened).

my load -gimp relevant- code:

image = gimp_image_new (50, 50, GIMP_GRAY); ...
for (i = 0; i < dataset_num_rasterbands; i++) { ...
get_band_data (&band[i], GDALGetRasterBand(dataset, i + 1), image, layer_number); /* rasterband count starts in 1 */ gimp_image_add_layer (image, band[i].layer_id, i); ...
}

gimp_image_resize_to_layers (image); gimp_display_new (image);

and the get_band_data code:

band->layer_id = gimp_layer_new (image, band->colorspace_name, band->width, band->height, GIMP_GRAY_IMAGE, 100.0, GIMP_NORMAL_MODE); drawable = gimp_drawable_get (band->layer_id); gimp_pixel_rgn_init (&pr, drawable, 0, 0, band->width, band->height, TRUE, FALSE);
...
gimp_pixel_rgn_set_rect (&pr, scaled_data, 0, 0, drawable->width, drawable->height);
gimp_drawable_flush (drawable);
gimp_drawable_detach (drawable);

That's all.

saulgoode@flashingtwelve.brickfilms.com
2007-04-16 15:16:37 UTC (about 17 years ago)

gimp_drawable_get_image fails?

Quoting coolhand :

and the get_band_data code:

band->layer_id = gimp_layer_new (image, band->colorspace_name, band->width, band->height, GIMP_GRAY_IMAGE, 100.0, GIMP_NORMAL_MODE); drawable = gimp_drawable_get (band->layer_id);

I don't understand your call to gimp_layer_new. Its arguments should be:

gimp_layer_new (GimpImage *image, gint width, gint height, GimpImageType type, const gchar *name, gdouble opacity, GimpLayerModeEffects mode)

coolhand
2007-04-17 10:32:42 UTC (about 17 years ago)

gimp_drawable_get_image fails?

I don't understand your call to gimp_layer_new. Its arguments should be:

gimp_layer_new (GimpImage *image, gint width, gint height, GimpImageType type, const gchar *name, gdouble opacity, GimpLayerModeEffects mode)

really not:

gint32 gimp_layer_new (gint32 image_ID, const gchar *name, gint width, gint height, GimpImageType type, gdouble opacity, GimpLayerModeEffects mode);

i use the color's scheme name as layer name.

Sven Neumann
2007-04-17 20:54:07 UTC (about 17 years ago)

gimp_drawable_get_image fails?

Hi,

On Mon, 2007-04-16 at 09:16 -0400, saulgoode@flashingtwelve.brickfilms.com wrote:

I don't understand your call to gimp_layer_new. Its arguments should be:

gimp_layer_new (GimpImage *image, gint width, gint height, GimpImageType type, const gchar *name, gdouble opacity, GimpLayerModeEffects mode)

That's gimp_layer_new() in the core. This function is different from the procedure that plug-ins are using.

Sven