It is currently Tue Jul 02, 2024 1:47 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Automating Layer mask application
PostPosted: Mon Jul 06, 2020 3:05 pm  (#1) 
Offline
New Member

Joined: Jul 06, 2020
Posts: 2
GIMP Version: 2.8.14
Operating System: Windows
GIMP Experience: New User



I have a lot of pairs of images with (1) color image named with the form "img-####.png" and (1) layer mask named with the form "img-####.png". The layer masks are usually but not always adjacent in number to the color images, not sure if that helps.

I have 0 experience with writing macros, installing macros, or running macros, so I will need some help with that if you're willing.

What I need is one or two macros that do the following:

Layer mask image:

Select All
Copy
Close image


Color image:

Add layer mask
Paste layer mask
Overwrite image
Close image


Can someone help me with this?


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: Automating Layer mask application
PostPosted: Mon Jul 06, 2020 4:12 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
This would be faster to do with a video editor, unless some kind hearted coder is willing to write a script for that. Basically using one image-sequence as a mask for another image-sequence.


Top
 Post subject: Re: Automating Layer mask application
PostPosted: Tue Jul 07, 2020 3:07 am  (#3) 
Online
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
KrytenKoro wrote:
GIMP Version: 2.8.14
Operating System: Windows
GIMP Experience: New User



I have a lot of pairs of images with (1) color image named with the form "img-####.png" and (1) layer mask named with the form "img-####.png". The layer masks are usually but not always adjacent in number to the color images, not sure if that helps.

I have 0 experience with writing macros, installing macros, or running macros, so I will need some help with that if you're willing.

What I need is one or two macros that do the following:

Layer mask image:

Select All
Copy
Close image


Color image:

Add layer mask
Paste layer mask
Overwrite image
Close image


Can someone help me with this?


Somewhat simpler to script:

* Load base layer (file-load)
* Load mask image as layer (file-load-layer)
* Copy any color channel to a plain channel (channel-new-from-component)
* Discard mask layer
* Create mask on layer (later-create-mask(ADD-MASK-CHANNEL)
* Save image

_________________
Image


Top
 Post subject: Re: Automating Layer mask application
PostPosted: Wed Jul 08, 2020 7:22 am  (#4) 
Offline
New Member

Joined: Jul 06, 2020
Posts: 2
ofnuts wrote:
KrytenKoro wrote:
GIMP Version: 2.8.14
Operating System: Windows
GIMP Experience: New User



I have a lot of pairs of images with (1) color image named with the form "img-####.png" and (1) layer mask named with the form "img-####.png". The layer masks are usually but not always adjacent in number to the color images, not sure if that helps.

I have 0 experience with writing macros, installing macros, or running macros, so I will need some help with that if you're willing.

What I need is one or two macros that do the following:

Layer mask image:

Select All
Copy
Close image


Color image:

Add layer mask
Paste layer mask
Overwrite image
Close image


Can someone help me with this?


Somewhat simpler to script:

* Load base layer (file-load)
* Load mask image as layer (file-load-layer)
* Copy any color channel to a plain channel (channel-new-from-component)
* Discard mask layer
* Create mask on layer (later-create-mask(ADD-MASK-CHANNEL)
* Save image

How would I do that?


Top
 Post subject: Re: Automating Layer mask application
PostPosted: Wed Jul 08, 2020 12:21 pm  (#5) 
Offline
GimpChat Member

Joined: Jan 03, 2014
Posts: 97
This is also an option:
https://stackoverflow.com/questions/564 ... th-imagema

Just tried it, works perfectly.


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Add layer mask hides the entire layer

3

No new posts Create Layer Mask From

8

No new posts Attachment(s) PYTON-FU-CREATE-LAYER-MASK-FROM...

3

No new posts Attachment(s) MAKING A PERFECT ELLIPSE FOR LAYER MASK

6

No new posts Attachment(s) Plugin gives non-destructive GEGL Filters in 2.99.19+ layer mask

2



* Login  



Powered by phpBB3 © phpBB Group