I settled on that route after some wrestling...

*** CODE HERE ***
(set! shadowMask (car(gimp-layer-create-mask shadowLayer ADD-ALPHA-MASK)))
       (gimp-layer-add-mask shadowLayer shadowMask)

       (gimp-selection-all inImage)
       (gimp-edit-copy inDrawable)
       (set! floatingSel (car (gimp-edit-paste shadowMask FALSE)))
       (gimp-floating-sel-anchor floatingSel)

       (gimp-layer-remove-mask shadowLayer MASK-APPLY)
***     ***

I hate scheme.  I had to do scheme while in school for a class, and I just
never, ever liked it.  However, I don't think my problem here was with
scheme (after, obviously, the initial refresher).  It was getting my head
around the api.  I still don't know how to get a reference to the color
channel (green, blue, or red.  Didn't matter.  Just needed the values).

Do you have a good link to coding python and gimp?  I found some stuff, but
it seemed old, and I wound up sticking with scheme.

Thanks in advance,

On 1/24/07, David Gowers <[EMAIL PROTECTED]> wrote:

On 1/23/07, Kevin Galligan <[EMAIL PROTECTED]> wrote:
> I've been trying to script something that seems relatively simple, yet
> I've spent the better part of today stuck at one little step.  I have
> started naming things with curse words, so I figured I'd reach out for help
> before I start throwing things.

Sounds familiar .. although that's happened much less to me since I
started using Python-Fu instead of Script-Fu.

I have a layer that I want to serve as the mask for another layer.  The
> values in the mask layer are white, so in theory, I could do the
> following...
> ;Somehow get the green Channel of the mask layer
> (set! greenChannelMask [magicFunctionHere])

(gimp-layer-add-mask myLayer greenChannelMask)
> I'm sure there's a more elegant way of doing it.  If so, please let me
> know.  However, if the above would work, I just need to know how to get that
> channel.  Should be easy, but I have been beating my head agaist a wall.  I
> just can't get it.  I tried 'gimp-image-get-channels' in the console just to
> see if I could do it the hard way, but it always returns '(0 #()#0"")', no
> matter what image, which leads me to believe I don't understand how that
> function works.  I also tried 'gimp-image-get-active-channel' in

The function returns a list of channels. ie. What you see in the bottom
part of the Channels dialog.

Anyway, you don't really need to get the green values, just get the
The way to do this is:

* Copy the mask layer (as in gimp-edit-copy -- or gimp-edit-named-copy if
you want to preserve the clipboard)
* Add a mask to the target layer *if needed*
* Paste onto the mask
* Anchor

the console, but that comes back with -1.  All the time.
> I probably wouldn't be so frustrated if this was a big deal, but should
> be easy to get the channel, yet I've burned much of the day and have made no
> other progress (other than, of course, having nowhere else to look).
> Thanks in advance,
> -Kevin

Gimp-developer mailing list

Reply via email to