It is currently Sat Apr 20, 2024 3:02 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 97 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Multiple Layer Actions Script Rel5.1 [Added 'Center All Layers']
PostPosted: Wed Jan 01, 2014 11:37 pm  (#1) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
This script will combine many of the functions done by Fenceposts all layers scripts with a lot of new features and more to be added, Thanks to GnuTux for conceiving the idea,
This Script is for 2.8 only at present
If anybody would like to contribute ideas for additional actions please let me know

There are 3 types of layers to effect
"All layers"
"Linked Layers"
"Non-Linked Layers"

At the moment there are 13 actions
"Set Invisible"
"Set Visible"
"Invert"
"Clear Selection"
"Layer to Image Size"
"Semi-Flatten"
"Flatten"
"Add Alpha"
"Remove Layers from Image"
"Desaturate"
"Colorify"
"Color Balance"
"AutoCrop Layers"
"Center All Layers"

More actions will be added soon


Image
Menu Location Layer/Multiple Layer Actions

; Rel 0.02 - Bugfix for Layers with Locked Pixels, Added additional actions 'Clear Selection' and 'Layer to Image Size'

; Rel 0.03 - Enabled layer group functionality

; Rel 0.04 - Added Additional Actions

; Rel 0.05 - Added Actions for Color: Desaturate, Colorify and Color Balance

; Rel 05.1↓ - Added Additional Actions


_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Last edited by Graechan on Mon Apr 13, 2015 7:15 pm, edited 12 times in total.

Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 2:06 am  (#2) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13011
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
Is there something that would clear a selection on all layers. If not maybe this could be added.

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 2:42 am  (#3) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Set all visible/invisible is quicker to do with Shift-click on eye icon,
color inversion on all layers...idk who'd need that
sorry missed the linked/non-linked part

my candidates for your script:

all layers to image size
add alpha channel to all layers
merge linked layers
delete linked layers

...just a few useful ops i can think of...

also ditto to what Wallace suggested


Last edited by K1TesseraEna on Thu Jan 02, 2014 2:58 am, edited 1 time in total.

Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 2:50 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Script doesn't execute (error message) if there is a layer(s) with locked pixels or locked transparency,
can you make your script ignore locked layers, Graechan?

thanks


Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 4:12 am  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4736
Wallace wrote:
Is there something that would clear a selection on all layers. If not maybe this could be added.


See clear-layers here : https://sourceforge.net/projects/gimp-t ... s/scripts/ :)

This said there is a limit to this kind of script... either you can only have function without parameters, or you end up redoing parameter entry dialogs for every tool you use. Or you have some clever code that can read the PDB, discovers the parameters and generates a dialog on the fly...

_________________
Image


Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 9:49 am  (#6) 
Offline
GimpChat Founder
User avatar

Joined: May 22, 2008
Posts: 5242
Location: Gimpville
Thanks for putting this together, Graechan. It's a good starting template.

I'd like to see the following added.
Horizontal & Vertical Flip
Semi-Flatten
Rotate 90 Clockwise & Counter Clockwise
Layer to Image size

_________________
“If you reach for the stars, you just might land on a decently sized hill.” - Stuart Hill


Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 3:13 pm  (#7) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 13011
Location: Native to NYC living in Arizona, Gimp 2.8 & 2.10, Win 11 PC.
I'd also like to see "Colorize all layer", with an option to colorize only visible layers.

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 4:27 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Back when I wrote my Combine BG script, I remember working on a similar concept. I started with the idea that the paste buffer could be used to hold the layer that was to be combined and so the command would be either "Paste" or "Paste Behind" to Overlay or Combine with each of the targeted layers.

This did not work out very well because the paste buffer gets centered relative to the target layer when pasting, resulting in the pasted image "moving" around unless all of the layers were the same size and in the same location. I then added a way to resize all of the layers to the image size but this only offered a partial solution -- the pasted image no longer moved around but unless the paste buffer contained an image-sized graphic, the position would still be centered in the image. Basically the paste buffer approach was a dead end.

Nonetheless, at the time I had written this, my script expanded to support several different operations on multiple layers, not just pasting and resizing. However, I did this in a way that fits my own quirky thought processes to which many might object. Mainly, I did not want to have special options that could be accomplished by just running the script additional times. For example, hiding a set of layers would entail showing the layers and then toggling their visibility; or rotating layers counter-clockwise could be accomplished by rotating clockwise and then pressing CTRL-f twice. I think this approach might still has merit, especially if you start getting into dozens of operations.

Here are the options I'd provided:
    SF-OPTION "Limit to" '( "All layers"
                            "Visible"
                            "Linked"
                            "Above active"
                            "Below active" )
    SF-TOGGLE "Include Active Layer" TRUE         
    SF-OPTION "Operation" '( "Do nothing"
                             "Add alpha channel"
                             "Autocrop"
                             "Layer to image size"
                             "Clear selected"
                             "Paste"
                             "Paste behind"
                             "Apply layer mask"
                             "Flip"
                             "Rotate 90" )
    SF-OPTION "Disposition" '( "Unchanged"
                               "Set visible"
                               "Set linked"
                               "Toggle visibility"
                               "Toggle linkage" )


For whatever it's worth, here is the link to the script I wrote (it did not, of course, support layer groups). I also recall making a later version that copied the active layer's blend mode or opacity to the target layers, but I can't locate the code for that.

PS: Not to be a grammar nazi, but your first option should be titled "Layers to Affect", not "Layers to Effect".

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: Multiple Layer Actions Script
PostPosted: Thu Jan 02, 2014 7:08 pm  (#9) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
K1TesseraEna thank you for finding that oversight I made, it wont be an issue in the next release
What to do with layer groups worries me, as I don't understand how to work within them

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Thu Jan 02, 2014 8:38 pm  (#10) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Rel2 has been added, see initial post
; Rel 0.02 - Bugfix for Layers with Locked Pixels, Added additional actions 'Clear Selection' and 'Layer to Image Size'

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Thu Jan 02, 2014 9:07 pm  (#11) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I agree with Tux this makes for a great template to add actions or processes to layers. Colorize would be a real great option to add perhaps as it was added to Blue Ice but on linked, un-linked, visible, and non visible layers/selections.
Selection to all other linked, non-linked, visible, non-visible layers would be great also.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Thu Jan 02, 2014 9:22 pm  (#12) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Thanks Rod in Rel2 I've added a preconditions section to the script

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Thu Jan 02, 2014 9:26 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Graechan wrote:
Thanks Rod in Rel2 I've added a preconditions section to the script


Great script Graechan and thank you. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Fri Jan 03, 2014 11:49 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Sep 22, 2012
Posts: 2089
Location: US
Thank you for the script G!
Keep holding my breath for more added functions!


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Fri Jan 03, 2014 3:25 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Jul 06, 2013
Posts: 2606
Location: California
I don't see the added actions & I downloaded the update.


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Fri Jan 03, 2014 11:34 pm  (#16) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Huston I have a problem as the script deals with layer lists that are created and if any of these have a layergroup ID it fails,
I've tried (if (= (gimp-item-is-group layerId) FALSE) (gimp-invert layerId)) among many other things

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Sat Jan 04, 2014 1:05 am  (#17) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
So to run the script on any layers they would have to be un-grouped and then re-grouped perhaps? :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Sat Jan 04, 2014 1:24 am  (#18) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Rod That restriction on a script seems 2 severe there, must be a solution to this dilemma and I hope Saulgoode can help (the master is looking at it now).
A solution will assist us all in future scripts

_________________
Image
No matter how much you push the envelope, it'll still be stationery.


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Sat Jan 04, 2014 2:02 am  (#19) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Awesome. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Multiple Layer Actions Script Rel2 [bugfix and more actions]
PostPosted: Sat Jan 04, 2014 5:27 am  (#20) 
Offline
Script Coder
User avatar

Joined: Nov 06, 2012
Posts: 239
Location: Italy
Graechan wrote:
Huston I have a problem as the script deals with layer lists that are created and if any of these have a layergroup ID it fails,
I've tried (if (= (gimp-item-is-group layerId) FALSE) (gimp-invert layerId)) among many other things


Try to replace the statement you proposed, that is:
(if (= (gimp-item-is-group layerId) FALSE) (gimp-invert layerId))

with this one:
(if (= (car (gimp-item-is-group layerId)) FALSE) (gimp-invert layerId))

_________________
Gino D's GIMP scripts: https://sites.google.com/site/ginodonig/gimp-scripts


Top
Post new topic Reply to topic  [ 97 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Unable to export jpg after added a new layer

14

No new posts Attachment(s) Multiple Layers Attributes/Mode .scm Updated

0

No new posts Attachment(s) Multiple Layer Shadow plugin

0

No new posts How do I script a new white layer to the bottom of the layer stack

7

No new posts Attachment(s) Plugin Actions RPL.

23



* Login  



Powered by phpBB3 © phpBB Group