It is currently Thu Jun 04, 2026 3:58 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: I need a script to set opacity for all layers. Is this possible?
PostPosted: Thu May 05, 2016 1:47 pm  (#1) 
Offline
New Member

Joined: May 05, 2016
Posts: 3
Hi all. I'm very inexperienced at coding, but I'm doing a project where I have hundreds of layers, and I need opacity for all set to 10. Instead of adjusting the slider for each single layer, I'd like a script to do it all at once.

I figure it's possible, I just don't know how to do it.

Thanks!


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: I need a script to set opacity for all layers. Is this possible?
PostPosted: Thu May 05, 2016 3:13 pm  (#2) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
Here, toss this in your gimp's scripts folder
Attachment:
set_all_layers_opacity.scm [1.67 KiB]
Downloaded 728 times

It'll be available under Script-Fu/Set All Layers Opacity...
Image
It only has one option (opacity).
Image




update: I just changed the script to accept floats instead of just integers so you can have like 10.5 as opacity.
Image

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: I need a script to set opacity for all layers. Is this possible?
PostPosted: Thu May 05, 2016 4:59 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
Finbar800 wrote:
Hi all. I'm very inexperienced at coding, but I'm doing a project where I have hundreds of layers, and I need opacity for all set to 10. Instead of adjusting the slider for each single layer, I'd like a script to do it all at once.

I figure it's possible, I just don't know how to do it.

Thanks!

Note that if you want to obtain an average of all layers where all layers participate equally, the answer is not to give them the same opacity, but instead to give the Nth layer an opacity of 1/N (with layer #1 being at the bottom, and fully opaque).

_________________
Image


Top
 Post subject: Re: I need a script to set opacity for all layers. Is this possible?
PostPosted: Thu May 05, 2016 5:38 pm  (#4) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4469
Location: Canada
offnuts mentioned a really good point.
I could've used a script like this when i was doing average images with multiple layers.
so here's one that won't accept a user input, it'll just set the n-th layer to have opacity of (1/n) * 100 opacity.
Image
Attachment:
set_all_layers_average_opacity.scm [1.84 KiB]
Downloaded 508 times

_________________
TinT
My GIMP 2.10 plug-in writer Fiverr Gig
Plaid Community Forum
Imageplaid-patterns.com


Top
 Post subject: Re: I need a script to set opacity for all layers. Is this possible?
PostPosted: Thu May 05, 2016 5:50 pm  (#5) 
Offline
GimpChat Member

Joined: May 09, 2012
Posts: 28
Hi Finbar: Just curious - what's the use case for 100's of layers, all with partial opacity?

_________________
Regards ... Alec


Top
 Post subject: Re: I need a script to set opacity for all layers. Is this possible?
PostPosted: Thu May 05, 2016 6:45 pm  (#6) 
Offline
New Member

Joined: May 05, 2016
Posts: 3
I'm essentially doing an average of a bunch of simple photos.


Top
 Post subject: Re: I need a script to set opacity for all layers. Is this possible?
PostPosted: Thu May 05, 2016 6:47 pm  (#7) 
Offline
New Member

Joined: May 05, 2016
Posts: 3
Thanks everyone! This will work perfectly!


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group