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

Scheme - image ID

This discussion is connected to the gimp-user-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.

9 of 11 messages available
Toggle history

Please log in to manage your subscriptions.

Scheme - image ID ugajin@talktalk.net 12 Mar 18:04
  56E463B5.5000503@ve3syb.ca 12 Mar 22:41
   4479155.46891457810040933.J... 12 Mar 22:41
    Scheme - image ID Kevin Cozens 12 Mar 22:41
     Scheme - image ID ugajin@talktalk.net 12 Mar 23:27
  Scheme - image ID ugajin@talktalk.net 12 Mar 19:20
   Scheme - image ID Kevin Payne 12 Mar 19:33
    Scheme - image ID ugajin@talktalk.net 12 Mar 21:30
     Scheme - random foreground colour ugajin@talktalk.net 13 Mar 18:40
      Scheme - random foreground colour Kevin Payne 13 Mar 20:48
       Scheme - random foreground colour ugajin@talktalk.net 13 Mar 21:11
ugajin@talktalk.net
2016-03-12 18:04:15 UTC (over 8 years ago)

Scheme - image ID

I would likke to find the image ID from a Scheme script.

(gimp-image-list) run in the Scheme console returns e.g. (1 #(5)) so I know from this that the image-id is 5, but if I have multiple docs open I may get the return value (2 #(8 5)). So how do I find and pass the correct image ID to a Scheme variable inside a script? E.g. (let* ( (img (cadr(gimp-image-list))) ) img ) now returns #(8 5).

I believe the function needed may be (gimp-item-get-image item), but how do I find the item-ID and assign it to a variable?

Any help is appreciated.

Thanks

-u

ugajin@talktalk.net
2016-03-12 19:20:43 UTC (over 8 years ago)

Scheme - image ID

I found the answer. Not sure why it wasn't working when I first tried it.

Still don't know how to get the item id as required by (gimp-item-get- image item) function.

-u

----Original Message----
From: ugajin@talktalk.net
Date: 12/03/2016 18:04
To:
Subj: [Gimp-user] Scheme - image ID

I would likke to find the image ID from a Scheme script.

(gimp-image-list) run in the Scheme console returns e.g. (1 #(5)) so

I

know from this that the image-id is 5, but if I have multiple docs

open

I may get the return value (2 #(8 5)). So how do I find and pass the correct image ID to a Scheme variable inside a script? E.g. (let* ( (img (cadr(gimp-image-list))) ) img ) now returns #(8 5).

I believe the function needed may be (gimp-item-get-image item), but how do I find the item-ID and assign it to a variable?

Any help is appreciated.

Thanks

-u _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list

Kevin Payne
2016-03-12 19:33:11 UTC (over 8 years ago)

Scheme - image ID

I'm puzzled what you're trying to do because it seems you're going about this backwards.

You would usually know the item ID because you know which image it's associated with, so wouldn't need to find the image that the item is associated with.

For example to get a layer-id, you'd have to know which image it's in, using: gimp-image-get-active-layer

Kevin

From: gimp-user-list  on behalf of ugajin@talktalk.net 
Sent: 12 March 2016 19:20
To: ugajin@talktalk.net; gimp-user-list@gnome.org
Subject: Re: [Gimp-user] Scheme - image ID

I found the answer. Not sure why it wasn't working when I first tried
it.

Still don't know how to get the item id as required by (gimp-item-get-
image item) function.

-u


>----Original Message----
>From: ugajin@talktalk.net
>Date: 12/03/2016 18:04
>To: 
>Subj: [Gimp-user] Scheme - image ID
>
>I would likke to find the image ID from a Scheme script.
>
>(gimp-image-list) run in the Scheme console returns e.g. (1 #(5)) so
I
>know from this that the image-id is 5, but if I have multiple docs
open
>I may get the return value (2 #(8 5)). So how do I find and pass the
>correct image ID to a Scheme variable inside a script? E.g. (let* (
>(img (cadr(gimp-image-list))) ) img ) now returns #(8 5).
>
>I believe the function needed may be (gimp-item-get-image item), but
>how do I find the item-ID and assign it to a variable?
>
>Any help is appreciated.
>
>Thanks
>
>-u
>_______________________________________________
>gimp-user-list mailing list
>List address:    gimp-user-list@gnome.org
>List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

>List archives:   https://mail.gnome.org/archives/gimp-user-list
>
ugajin@talktalk.net
2016-03-12 21:30:35 UTC (over 8 years ago)

Scheme - image ID

There are quite a few functions that require 'item' as a parameter. The procedure browser says: 'item ITEM The item' which isn't very helpful, but in actual fact I don't need it. I have an idea why the script initially failed, and it is fixed now and working fine.

Thanks

----Original Message----
From: paynekj@hotmail.com
Date: 12/03/2016 19:33
To: "gimp-user-list@gnome.org"
Subj: Re: [Gimp-user] Scheme - image ID

I'm puzzled what you're trying to do because it seems you're going

about this backwards.

You would usually know the item ID because you know which image it's

associated with, so wouldn't need to find the image that the item is associated with.

For example to get a layer-id, you'd have to know which image it's in,

using: gimp-image-get-active-layer

Kevin

________________________________________ From: gimp-user-list on behalf of

ugajin@talktalk.net

Sent: 12 March 2016 19:20
To: ugajin@talktalk.net; gimp-user-list@gnome.org Subject: Re: [Gimp-user] Scheme - image ID

I found the answer. Not sure why it wasn't working when I first tried it.

Still don't know how to get the item id as required by (gimp-item-get- image item) function.

-u

----Original Message----
From: ugajin@talktalk.net
Date: 12/03/2016 18:04
To:
Subj: [Gimp-user] Scheme - image ID

I would likke to find the image ID from a Scheme script.

(gimp-image-list) run in the Scheme console returns e.g. (1 #(5)) so

I

know from this that the image-id is 5, but if I have multiple docs

open

I may get the return value (2 #(8 5)). So how do I find and pass the correct image ID to a Scheme variable inside a script? E.g. (let* ( (img (cadr(gimp-image-list))) ) img ) now returns #(8 5).

I believe the function needed may be (gimp-item-get-image item), but how do I find the item-ID and assign it to a variable?

Any help is appreciated.

Thanks

-u _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list

_______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list

Kevin Cozens
2016-03-12 22:41:19 UTC (over 8 years ago)

Scheme - image ID

On 16-03-12 02:14 PM, ugajin@talktalk.net wrote:

I want to get the id from within the script. I found the answer. Not sure why it wasn't working when I first tried it. I hadn't made the connection between image id and the title bar data.

Still don't know how to get the item id as required by (gimp-item-get- image item) function.

You said you found the answer then your last statement seems to indicate you haven't.

Apart from the previous suggestions on how to find the image ID I had another thought. If you are writing a script where you want to right click an image and run your script from the menu that will pop up you can set up your script so the image ID and drawable ID are automatically passed to your script.

In the script-fu-register block where you have the list of SF-* parameters, you add two lines right before any other SF-* parameters: SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0

In the define for your script you would add "image" and "drawable" as the first two parameters expected by your script. You can use any variable names you want in place of "image" and "drawable".

If your define was (define (my-script-fu-script param1 param2) you would change it to
(define (my-script-fu-script image drawable param1 param2)

The variable name "image" will automatically be set to the ID of the image that you right clicked.

Cheers!

Kevin.

http://www.ve3syb.ca/           |"Nerds make the shiny things that distract
Owner of Elecraft K2 #2172      | the mouth-breathers, and that's why we're
                                 | powerful!"
#include  |             --Chris Hardwick
ugajin@talktalk.net
2016-03-12 23:27:06 UTC (over 8 years ago)

Scheme - image ID

Yus!

----Original Message----
From: kevin@ve3syb.ca
Date: 12/03/2016 22:41
To: "gimp-user"
Subj: Re: [Gimp-user] Scheme - image ID

On 16-03-12 02:14 PM, ugajin@talktalk.net wrote:

I want to get the id from within the script. I found the answer. Not sure why it wasn't working when I first tried it. I hadn't made the connection between image id and the title bar data.

Still don't know how to get the item id as required by (gimp-item-

get-

image item) function.

You said you found the answer then your last statement seems to

indicate you

haven't.

Apart from the previous suggestions on how to find the image ID I had another thought. If you are writing a script where you want to right

click

an image and run your script from the menu that will pop up you can

set up

your script so the image ID and drawable ID are automatically passed

to your

script.

In the script-fu-register block where you have the list of SF-*

parameters,

you add two lines right before any other SF-* parameters: SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0

In the define for your script you would add "image" and "drawable" as

the

first two parameters expected by your script. You can use any variable

names

you want in place of "image" and "drawable".

If your define was (define (my-script-fu-script param1 param2) you would change it to
(define (my-script-fu-script image drawable param1 param2)

The variable name "image" will automatically be set to the ID of the

image

that you right clicked.

-- Cheers!

Kevin.

http://www.ve3syb.ca/ |"Nerds make the shiny things that

distract

Owner of Elecraft K2 #2172 | the mouth-breathers, and that's why

we're

| powerful!"
#include | --Chris Hardwick _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list

ugajin@talktalk.net
2016-03-13 18:40:58 UTC (over 8 years ago)

Scheme - random foreground colour

Hi,

Can anyone tell me please, how to pass random values as colour parameter list with script-fu?

Thanks

-u

Kevin Payne
2016-03-13 20:48:52 UTC (over 8 years ago)

Scheme - random foreground colour

Try

(list (rand 255) (rand 255) (rand 255))

for example: (gimp-context-set-foreground (list (rand 255) (rand 255) (rand 255)))

Kevin

From: gimp-user-list  on behalf of ugajin@talktalk.net 
Sent: 13 March 2016 18:40
To: gimp-user-list@gnome.org
Subject: [Gimp-user] Scheme - random foreground colour

Hi,

Can anyone tell me please, how to pass random values as colour
parameter list with script-fu?

Thanks

-u
ugajin@talktalk.net
2016-03-13 21:11:09 UTC (over 8 years ago)

Scheme - random foreground colour

Thanks a bunch - mucho appreciated!

-u

----Original Message----
From: paynekj@hotmail.com
Date: 13/03/2016 20:48
To: "ugajin@talktalk.net", "gimp-user-list@gnome.

org"

Subj: Re: [Gimp-user] Scheme - random foreground colour

Try

(list (rand 255) (rand 255) (rand 255))

for example: (gimp-context-set-foreground (list (rand 255) (rand 255)

(rand 255)))

Kevin

________________________________________ From: gimp-user-list on behalf of

ugajin@talktalk.net

Sent: 13 March 2016 18:40
To: gimp-user-list@gnome.org
Subject: [Gimp-user] Scheme - random foreground colour

Hi,

Can anyone tell me please, how to pass random values as colour parameter list with script-fu?

Thanks

-u _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list