It is currently Sun Apr 28, 2024 7:03 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Re: How copy a layer as layer mask
PostPosted: Tue Feb 28, 2012 2:53 am  (#11) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4739
PhotoComix wrote:
Rod wrote:
Cant you just create a new layer add a mask and select the other layer and copy and paste the layer into the mask?
that was what i planned but copy and paste on the layermask doesn't work (that just create a floating selection)

Hehe.... actually you were on the right track... it creates a floating selection but if you are working on a layer mask, anchoring the selection puts it in the mask. So it's actually quite simple :)

_________________
Image


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Tue Feb 28, 2012 5:04 am  (#12) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
I have made a minor revision of the script to better handle text layers. If the above layer is a text layer and it has a layermask then there is no change in the behavior; that layermask is added to the active layer.

However, if the above layer is a text layer without a layermask (a fairly common occurrence for text layers), then the layermask will be created from the text itself, regardless of the color of the text.

The reason for this change is that the transparent background of a layer gets converted to black when copied to a mask. For a text layer this generally is not how you want the mask to be created. For example, if you have black text then the resulting mask would be entirely black. Other colors except for pure white would be some shade of gray. The script now assumes that you want the text part of the mask to be white.

Here is the new link (I've also updated my previous post):
http://chiselapp.com/user/saulgoode/rep ... from-above

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Tue Feb 28, 2012 6:56 am  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 06, 2011
Posts: 368
Location: US, Ohio
PhotoComix wrote:
GIMP Version: 2.7.5
Operating System: Windows
OS Version: XP - SP3
GIMP Experience: Basic Level



I forgot it!
i have a bw image that i need to paste as layermask...should be simple but i am stuck i even look the help but didn't helped much :gaah

PS i loaded the image i want copy as layermask as layer, it has same size of the other layer



I usually paste the image as a layer, and then right click on the newly created layer and click "add layer mask."

I then initialize the layer mask to "grayscale copy of layer."

After that I right-click on the newly created layer mask and click "mask to selection"

I the right click on the layer I want my mask on and click "add layer mask"
I initialize the mask to selection.


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Tue Feb 28, 2012 1:25 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Yes i imagine i should have mentioned "anchor the layer" :)

_________________
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: How copy a layer as layer mask
PostPosted: Tue Feb 28, 2012 6:49 pm  (#15) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Saulgoode on the layer above if the text is black with transparent background the layer mask created is still all black.

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


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Tue Feb 28, 2012 6:59 pm  (#16) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Graechan wrote:
Saulgoode on the layer above if the text is black with transparent background the layer mask created is still all black.

Did you download the updated version of the script mentioned in this post? It is possible I've made a mistake (I made one once before, back in 1993), so let me know if you have the updated version and are still seeing the behavior you describe.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Wed Feb 29, 2012 2:00 am  (#17) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Just redownloaded and installed, top layer is black text, selected bottom layer is gray background color, there is no mask on either, I run script bottom layer has all black mask. Script has not changed.

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


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Wed Feb 29, 2012 6:02 am  (#18) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
ofnuts wrote:
PhotoComix wrote:
Rod wrote:
Cant you just create a new layer add a mask and select the other layer and copy and paste the layer into the mask?
that was what i planned but copy and paste on the layermask doesn't work (that just create a floating selection)

Hehe.... actually you were on the right track... it creates a floating selection but if you are working on a layer mask, anchoring the selection puts it in the mask. So it's actually quite simple :)


That it what i thought !
but no matter how much i tried the floating selection accepted only to be pasted on the layer below not on its mask (yes i click on the mask in the layer windows to be sure it was active)

PS this using gimp2.7.5 from partha i didn't try with the stable version

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Wed Feb 29, 2012 6:58 am  (#19) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Graechan wrote:
Just redownloaded and installed, top layer is black text, selected bottom layer is gray background color, there is no mask on either, I run script bottom layer has all black mask. Script has not changed.

Hmmm, strange.
Attachment:
copymask.gif
copymask.gif [ 310.05 KiB | Viewed 1315 times ]


What version of GIMP are you using?

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Wed Feb 29, 2012 6:18 pm  (#20) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Saulgoode I am using 2.6.11 but here is the bug I think, look at the text layer I used.

Image

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


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Wed Feb 29, 2012 6:35 pm  (#21) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Aha! Although the graphics on your top layer are text, it is not a "text layer" in that the text information has been discarded (note the difference between the thumbnail of your "Gimp" layer and mine). Once the text attributes of a layer have been discarded, my script treats it as a normal layer wherein transparency gets converted to black in the resulting mask.

The script could be used by first creating a mask on your "Gimp" layer initialized to its alpha channel, but it is probably just as easy if not easier to use the stock GIMP approach of alpha-selecting the "Gimp" layer and then adding a mask to your base layer initialized to that selection.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Wed Feb 29, 2012 7:28 pm  (#22) 
Offline
Script Coder
User avatar

Joined: Feb 18, 2011
Posts: 4827
Location: Bendigo Vic. Australia
Thats wright Saulgoode ,I was being lazy and used a short script I had for creating text on a backgound, so I am sorry for any delema I might have caused :oops:

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


Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Thu Mar 22, 2012 1:38 pm  (#23) 
Offline
GimpChat Member

Joined: Apr 12, 2010
Posts: 5870
:bump Bump !

I think we should modify the topic title and move everything the script board !

I think so because contain useful script that as now would be hard to find !
i am sure would be hard to find because even if was a my request for me was hard to trace back this pages
(i searched well in the script board but i didn't think could be in this board for long...)

_________________
My 3D Gallery on Deviantart http://photocomix2.deviantart.com/
Main gallery http://www.flickriver.com/photos/photocomix-mandala/
Mandala and simmetry http://www.flickriver.com/photos/photocomix_mandala/

Image

Mrs Wilbress


Last edited by PhotoComix on Thu Mar 22, 2012 1:46 pm, edited 2 times in total.

Top
 Post subject: Re: How copy a layer as layer mask
PostPosted: Thu Mar 22, 2012 1:40 pm  (#24) 
Offline
GimpChat Member
User avatar

Joined: Sep 06, 2011
Posts: 368
Location: US, Ohio
This is fantastic...absolutely fantastic.


Top
 Post subject: Re: [SOLVED] I need a script to convert a layer in a layer mask
PostPosted: Thu Mar 22, 2012 8:39 pm  (#25) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Moved to Gimp Scripts and Plugins per request by PC. :)

_________________
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 new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


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

3

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

7

No new posts Create Layer Mask From

8

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

3

No new posts Automating Layer mask application

4



* Login  



Powered by phpBB3 © phpBB Group