You are here

Script-fu console not obeying me?

or am I telling it the wrong thing to do?

> (gimp-image-new 256 256 RGB)
(2)
---I think I've created image 2.

> (gimp-layer-new 3 256 256 RGB-IMAGE "foobar" 100 NORMAL-MODE)
Error: Procedure execution of gimp-layer-new failed on invalid input arguments: Procedure 'gimp-layer-new' has been called with an invalid ID for argument 'image'. Most likely a plug-in is trying to work on an image that doesn't exist any longer.
---Okay, this one is my bad.

> (gimp-layer-new 2 256 256 RGB-IMAGE "foobar" 100 NORMAL-MODE)
(5)
---I think I've created layer 5 in image 2.

> (gimp-drawable-fill 5 BG-IMAGE-FILL)
(#t)
> (gimp-image-pick-color 2 5 10 10 TRUE FALSE 1)
((0 0 0))
---Oops, left out a step of what I want to do.

> (gimp-context-set-background '(10 20 30))
(#t)
---I think I've just set the background color to R 10 G 20 B 30.

> (gimp-image-pick-color 2 5 10 10 TRUE FALSE 1)
((0 0 0))
---Oops, left out a step of what I want to do.

> (gimp-drawable-fill 5 BG-IMAGE-FILL)
(#t)
---I think I'm filling drawable 5 with R 10 G 20 B 30.

> (gimp-image-pick-color 2 5 10 10 TRUE FALSE 1)
((0 0 0))
---I thought I was telling the console to pick the color at XY 10 10. I was expecting this return from the console to be ((10 20 30)). Is the console not obeying me or am I telling it the wrong thing to do?

> (gimp-context-get-background)
((10 20 30))
---So I did set the background correctly. Why didn't the pick work?

The fifth parameter to 'gimp-image-pick-color' determines whether the color is sampled from the image (TRUE) or the drawable (FALSE). You are instructing the function to sample from the image, yet you have not added your new layer to the image. After creating a layer, you still need to use 'gimp-image-add-layer' to assign it to the image. Adding the layer is typically necessary and should be done soon after creating it so as to avoid problems such as this. Alternately, you could have set the fifth parameter to FALSE so that the color is sampled from the layer. => (gimp-image-pick-color 2 4 10 10 FALSE FALSE 1) ((10 20 30))

> (gimp-image-new 256 256 RGB) (1) > (gimp-layer-new 1 256 256 RGB-IMAGE "foobar" 100 NORMAL-MODE) (2) > (gimp-image-add-layer 1 2 -1) (#t) > (gimp-context-set-background '(10 20 30)) (#t) > (gimp-drawable-fill 2 BG-IMAGE-FILL) (#t) > (gimp-image-pick-color 1 2 10 10 TRUE FALSE 1) ((10 20 30))
Subscribe to Comments for "Script-fu console not obeying me?"