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

Script-fu plugin

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.

10 of 11 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu plugin Adonj Adonj 28 Sep 06:03
  script-fu plugin peter kostov 28 Sep 10:28
   Script-fu Adonj Adonj 28 Sep 15:31
  script-fu plugin saulgoode@flashingtwelve.brickfilms.com 28 Sep 20:18
Script-fu plugin Adonj Adonj 28 Sep 21:44
  Script-fu plugin saulgoode@flashingtwelve.brickfilms.com 28 Sep 23:41
Script-fu plugin Adonj Adonj 29 Sep 01:06
Script-fu plugin Adonj Adonj 09 Oct 16:09
  Script-fu plugin JohnWilkins 04 Apr 06:27
mailman.216254.1222626574.1... 07 Oct 20:19
  script-fu plugin Bernd Weber 30 Sep 12:36
Adonj Adonj
2008-09-28 06:03:52 UTC (over 15 years ago)

script-fu plugin

I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should copy a layer mask to multiple layers or apply a layer mask to multiple layers. I get an error each time I make an attempt to use it, which states: "Error: cons: needs 2 argument(s)"
I'm not familiar with the script. Could there be a simple solution to that? Here is the script:

; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ;
; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. (define (script-fu-copy-mask-to-layers image drawable) (define (visible-layers img)
(let* (
(all-layers (gimp-image-get-layers img)) (i (car all-layers))
(viewable ())
(tmp FALSE))
(set! all-layers (cadr all-layers)) (while (> i 0)
(set! tmp (car (gimp-drawable-get-visible (aref all-layers (- i 1)))))
(if (= tmp TRUE)
(set! viewable (append viewable (cons (aref all-layers (- i 1))))))
(set! i (- i 1)))
viewable))
(let* (
(active-layer (car (gimp-image-get-active-layer image))) (source-layer)
(source-mask)
(layers)
(mask))
(set! layers (visible-layers image)) (gimp-image-undo-group-start image) (set! source-layer (car (gimp-layer-new-from-drawable active-layer image)))
(gimp-image-add-layer image source-layer -1) (set! source-mask (car (gimp-layer-get-mask source-layer))) (if (= source-mask -1)
(begin
(set! source-mask (car (gimp-layer-create-mask source-layer ADD-COPY-MASK)))
(gimp-layer-add-mask source-layer source-mask))) (while (car layers)
(if (= (car (gimp-layer-get-mask (car layers))) -1) (if (= (car (gimp-drawable-has-alpha (car layers))) 1) (set! mask (car (gimp-layer-add-mask (car layers) source-mask)))))
(set! layers (cdr layers)))
(gimp-image-remove-layer image source-layer) (gimp-image-undo-group-end image)
(gimp-displays-flush)))
(script-fu-register "script-fu-copy-mask-to-layers" "/Script-Fu/_Copy mask"
"Copy the mask from the current layer to all visible layers" "Saul Goode"
"Saul Goode"
"6/14/2006"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)

__________________

peter kostov
2008-09-28 10:28:50 UTC (over 15 years ago)

script-fu plugin

Adonj Adonj wrote:

I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should copy a layer mask to multiple layers or apply a layer mask to multiple layers. I get an error each time I make an attempt to use it, which states: "Error: cons: needs 2 argument(s)"
I'm not familiar with the script. Could there be a simple solution to that? Here is the script:

; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ;
; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. (define (script-fu-copy-mask-to-layers image drawable) (define (visible-layers img)
(let* (
(all-layers (gimp-image-get-layers img)) (i (car all-layers))
(viewable ())
(tmp FALSE))
(set! all-layers (cadr all-layers)) (while (> i 0)
(set! tmp (car (gimp-drawable-get-visible (aref all-layers (- i 1)))))
(if (= tmp TRUE)
(set! viewable (append viewable (cons (aref all-layers (- i 1))))))
(set! i (- i 1)))
viewable))
(let* (
(active-layer (car (gimp-image-get-active-layer image))) (source-layer)
(source-mask)
(layers)
(mask))
(set! layers (visible-layers image)) (gimp-image-undo-group-start image) (set! source-layer (car (gimp-layer-new-from-drawable active-layer image)))
(gimp-image-add-layer image source-layer -1) (set! source-mask (car (gimp-layer-get-mask source-layer))) (if (= source-mask -1)
(begin
(set! source-mask (car (gimp-layer-create-mask source-layer ADD-COPY-MASK)))
(gimp-layer-add-mask source-layer source-mask))) (while (car layers)
(if (= (car (gimp-layer-get-mask (car layers))) -1) (if (= (car (gimp-drawable-has-alpha (car layers))) 1) (set! mask (car (gimp-layer-add-mask (car layers) source-mask)))))
(set! layers (cdr layers)))
(gimp-image-remove-layer image source-layer) (gimp-image-undo-group-end image)
(gimp-displays-flush)))
(script-fu-register "script-fu-copy-mask-to-layers" "/Script-Fu/_Copy mask"
"Copy the mask from the current layer to all visible layers" "Saul Goode"
"Saul Goode"
"6/14/2006"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)

Isn't that a script rather a plug-in? If so it should reside in the scripts folder... But this is gust a guess. I am not familiar with script-fu eithe :(

Peter

_________________________________________________________________

_______________________________________________ Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Adonj Adonj
2008-09-28 15:31:17 UTC (over 15 years ago)

Script-fu

You're absolutely right Peter, my mistake, I meant the script folder C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts.That's where it resides.The new script-fu tab does appear correctly in my image window, however the error I described is present when I click on the tab. Adonj
__________________

saulgoode@flashingtwelve.brickfilms.com
2008-09-28 20:18:23 UTC (over 15 years ago)

script-fu plugin

Quoting Adonj Adonj :

I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should
copy a layer mask to multiple layers or apply a layer mask to multiple layers.
I get an error each time I make an attempt to use it, which states: "Error: cons: needs 2 argument(s)"
I'm not familiar with the script. Could there be a simple solution to that?

I have updated the script, which can be fetched from http://flashingtwelve.brickfilms.com/GIMP/Scripts/copy-mask.scm

Adonj Adonj
2008-09-28 21:44:55 UTC (over 15 years ago)

Script-fu plugin

Thank you Saul, that worked perfectly!

With regards to your message at: http://72.14.205.104/search?q=cache:7GovFRKtKToJ:lists.xcf.berkeley.edu/lists/gimp-user/2007-January/009388.html+plugin+to+copy+mask+to+all+layers+then+apply&hl=en&ct=clnk&cd=2&gl=ca You say:

You can achieve the same result using layer masks. Unfortunately, there is not a simple built-in way of copying a layer mask to multiple layers or of applying a layer mask to multiple layers. There is a script-fu plugin that will do that. I don't know where I got it. It doesn't seem to be in the Gimp's plugin repository. So here it is:.........

I wondered if you knew of a script that would also APPLY the copied layers as you mention. Thanks,
Adonj

__________________

saulgoode@flashingtwelve.brickfilms.com
2008-09-28 23:41:40 UTC (over 15 years ago)

Script-fu plugin

Quoting Adonj Adonj :

I wondered if you knew of a script that would also APPLY the copied layers as you mention.

Edit the script to add the following code:

(set! layers (visible-layers image)) (while (pair? layers)
(gimp-layer-remove-mask (car layers) MASK-APPLY) (set! layers (cdr layers)))

Just before the line:

(gimp-image-remove-layer image source-layer)

Adonj Adonj
2008-09-29 01:06:07 UTC (over 15 years ago)

Script-fu plugin

That was terrific, Saul, thanks a lot!
Adonj
__________________

Bernd Weber
2008-09-30 12:36:47 UTC (over 15 years ago)

script-fu plugin

Hi,

I checked your script a little. I have to admit, that I don't know scheme very much, because I don't like LISP very much (Lots of Irritating Superfluous Parentheses). I rather work with perl-gimp. But there is an error in your script. Scheme has a built-in function cons. Cons needs two arguments. There is only given one:

(if (= tmp TRUE) (set! viewable (append viewable (cons (aref all-layers (- i 1))))))

To make it clearer: The one argument is: aref all-layers (- i 1)

I don't know which argument to give as second. It would take me a while to figure it out.

One other thing is disturbing: In the register-function isn't given if it is a stand allone script or if it should work on an image. I assumed it should work on an image.

To test your script I set: "/Script-Fu/_Copy mask" .
May be in special cases, the function aref provides twp arguments for cons, for example if you have sufficient layers and layer masks, but in others it doesn*t. Anyhow the error isn't caught.

I am working with LINUX, so you see that the error is OS-Independent.

Greetings

Bernd

gimp-user-request@lists.XCF.Berkeley.EDU schrieb:

Send Gimp-user mailing list submissions to gimp-user@lists.XCF.Berkeley.EDU

To subscribe or unsubscribe via the World Wide Web, visit https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user or, via email, send a message with subject or body 'help' to gimp-user-request@lists.XCF.Berkeley.EDU

You can reach the person managing the list at gimp-user-owner@lists.XCF.Berkeley.EDU

When replying, please edit your Subject line so it is more specific than "Re: Contents of Gimp-user digest..."

Today's Topics:

1. script-fu plugin (Adonj Adonj) 2. Re: script-fu plugin (peter kostov) 3. Re: Best way to semi-flatten a transparent gif against a background image (Justyn Butler) 4. Script-fu (Adonj Adonj)
5. Re: Best way to semi-flatten a transparent gif against a background image (David Gowers) 6. Re: script-fu plugin (saulgoode@flashingtwelve.brickfilms.com) 7. Re: Gimp-user Digest, Vol 72, Issue 22 (Mike W)

----------------------------------------------------------------------

Message: 1 Date: Sun, 28 Sep 2008 00:03:52 -0400 From: Adonj Adonj
Subject: [Gimp-user] script-fu plugin To: "gimp-user@lists.XCF.Berkeley.EDU"
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"

I'm using gimp2.4.7 in windows XP. I copied a script-fu plugin I found to my C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins, which should copy a layer mask to multiple layers or apply a layer mask to multiple layers. I get an error each time I make an attempt to use it, which states: "Error: cons: needs 2 argument(s)"
I'm not familiar with the script. Could there be a simple solution to that? Here is the script:

; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ;
; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. (define (script-fu-copy-mask-to-layers image drawable) (define (visible-layers img)
(let* (
(all-layers (gimp-image-get-layers img)) (i (car all-layers))
(viewable ())
(tmp FALSE))
(set! all-layers (cadr all-layers)) (while (> i 0)
(set! tmp (car (gimp-drawable-get-visible (aref all-layers (- i 1)))))
(if (= tmp TRUE)
(set! viewable (append viewable (cons (aref all-layers (- i 1))))))
(set! i (- i 1)))
viewable))
(let* (
(active-layer (car (gimp-image-get-active-layer image))) (source-layer)
(source-mask)
(layers)
(mask))
(set! layers (visible-layers image)) (gimp-image-undo-group-start image) (set! source-layer (car (gimp-layer-new-from-drawable active-layer image)))
(gimp-image-add-layer image source-layer -1) (set! source-mask (car (gimp-layer-get-mask source-layer))) (if (= source-mask -1)
(begin
(set! source-mask (car (gimp-layer-create-mask source-layer ADD-COPY-MASK)))
(gimp-layer-add-mask source-layer source-mask))) (while (car layers)
(if (= (car (gimp-layer-get-mask (car layers))) -1) (if (= (car (gimp-drawable-has-alpha (car layers))) 1) (set! mask (car (gimp-layer-add-mask (car layers) source-mask)))))
(set! layers (cdr layers)))
(gimp-image-remove-layer image source-layer) (gimp-image-undo-group-end image)
(gimp-displays-flush)))
(script-fu-register "script-fu-copy-mask-to-layers" "/Script-Fu/_Copy mask"
"Copy the mask from the current layer to all visible layers" "Saul Goode"
"Saul Goode"
"6/14/2006"
""
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)

__________________

Adonj Adonj
2008-10-09 16:09:19 UTC (over 15 years ago)

Script-fu plugin

I updated my Gimp program from version 2.4.7 to 2.6.0-i686. The Script-fu plugin copyToAllLayers.scm gave an error, and a Gimp Message: "Plug-In 'Copy mask' left image undo in inconsistent state, closing open undogroups". I wondered if you have a correction for the code.Very much appreciated.

Quoting Adonj Adonj :

I wondered if you knew of a script that would also APPLY the copied layers as you mention.

Edit the script to add the following code: (set! layers (visible-layers image))(while (pair? layers)(gimp-layer-remove-mask (car layers) MASK-APPLY)(set! layers (cdr layers))) Just before the line: (gimp-image-remove-layer image source-layer)

__________________

2020-04-04 06:27:34 UTC (about 4 years ago)
postings
2

Script-fu plugin

No! That is also not fair. I think we are supposed to kill anyone. Humanity is the biggest religion and we all are humans but now I'm [url=https://assignmentjunkie.co.uk/buy-assignment-online]buying assignmentin in UK[/url] to manage my assignment work. It’s our choice to live our live according to our wish. Thus I will not allow my kids to play such games.