It is currently Thu Jun 27, 2024 6:58 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Batch Create Layers
PostPosted: Sat Mar 21, 2020 8:39 pm  (#1) 
Offline
GimpChat Member

Joined: Jul 23, 2019
Posts: 6
GIMP Version: 2.10.18
Operating System: Linux
OS Version: Ubuntu MATE
GIMP Experience: Intermediate Level



Hello all you lovely people,

I am looking for a way in GIMP (either with script-fu or python-fu) to batch create defined layers and layer groups in each of my image files in order to get rid of a bad habit of not using many layers. I am going through an exhausting process of "re-layering" my figure drawings in GIMP, and I was hoping to find a way to save some time.

I also would really like them to be "Default" layers, and not "Legacy", since I am using GIMP 2.10.18.

For example, let's say I want to make a tree of layers like this:

Layer "Sketch #1", linked, normal, opacity 65.0
Layer "Sketch #2", linked, normal, opacity 40.0
Layer "Sketch #3", linked, normal, opacity 25.0
Layer Group "Group #1", normal, opacity 65.0
+-- Layer "Group #1 Head", linked, normal, opacity 100
+-- Layer "Group #1 Ears", linked, normal, opacity 100
+-- Layer "Group #1 Eyes", linked, normal, opacity 100
+-- Layer "Group #1 Face", linked, normal, opacity 100
+-- Layer "Group #1 Arm Front", linked, normal, opacity 100
+-- Layer "Group #1 Arm Back", linked, normal, opacity 100
+-- Layer "Group #1 Hand Front", linked, normal, opacity 100
+-- Layer "Group #1 Hand Back", linked, normal, opacity 100
+-- Layer "Group #1 Body", linked, normal, opacity 100
+-- Layer "Group #1 Leg Front", linked, normal, opacity 100
+-- Layer "Group #1 Leg Back", linked, normal, opacity 100
+-- Layer "Group #1 Foot Front", linked, normal, opacity 100
+-- Layer "Group #1 Foot Back", linked, normal, opacity 100
Layer Group "Group #2", normal, opacity 100
+-- Layer "Group #2 Head", linked, normal, opacity 100
+-- Layer "Group #2 Ears", linked, normal, opacity 100
+-- Layer "Group #2 Eyes", linked, normal, opacity 100
+-- Layer "Group #2 Face", linked, normal, opacity 100
+-- Layer "Group #2 Arm Front", linked, normal, opacity 100
+-- Layer "Group #2 Arm Back", linked, normal, opacity 100
+-- Layer "Group #2 Hand Front", linked, normal, opacity 100
+-- Layer "Group #2 Hand Back", linked, normal, opacity 100
+-- Layer "Group #2 Body", linked, normal, opacity 100
+-- Layer "Group #2 Leg Front", linked, normal, opacity 100
+-- Layer "Group #2 Leg Back", linked, normal, opacity 100
+-- Layer "Group #2 Foot Front", linked, normal, opacity 100
+-- Layer "Group #2 Foot Back", linked, normal, opacity 100
Layer "Scenery FG", linked, normal, opacity 100
Layer "Scenery BG", linked, normal, opacity 100
Layer "Background", normal, opacity 100


So yeah, I need to do something like this in every unfinished drawing I have.

I want them to be able to be named, linked, and have their opacity set. Optionally, creating layer masks would be nice, but it is not a requirement. I usually create those if I need them on the fly.

Thank you so much for any help you can give!


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: Batch Create Layers
PostPosted: Tue Mar 24, 2020 4:37 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1362
No takers eh?

I don't think you want a script to make content within new layers do you?
If you are not doing animation then all of your layers will have to be merged down for any sort of publication/printing.

A simple way of doing layer operations is just by using the keyboard.
EG. you can duplicate every layer by using the arrow up key and the duplicate button.
You can also copy and past layers to a new image with Ctrl-c and Ctrl-v
You can also copy whole layer groups to a new image by linking the group and then dropping the group into a new image at the layer you want it.

I use tims 'run code on visible layers' in python which is just a box you can paste python code into.
I have is set-up with this code: if layer.has_alpha: pdb.gimp_layer_flatten(layer)
Because I remove alpha from many layers often.


Top
 Post subject: Re: Batch Create Layers
PostPosted: Tue Mar 24, 2020 6:55 am  (#3) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4750
As answered elsewhere, the no-script solution is to prepare an XCF with the aforementioned layers, and add them to any image with "File>Open as layers".

If necessary the layers can be resized to fill the canvas with a script such as ofn-layers-to-image-size.

_________________
Image


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Export Layers by Khalim19 as batch action proces.

3

No new posts Attachment(s) Distorting Layers to Create Map "Gores"

3

No new posts Attachment(s) converting 32 bit images to 8 bit using batch script

5

No new posts Attachment(s) Seeking Help with First Multi-File Batch Script

9

No new posts Attachment(s) Problem with David's Batch Processor plugin

22



* Login  



Powered by phpBB3 © phpBB Group