You are here

Can someone write a simple script for me?

Hi, I'm not a new gimp user but I'm totally and completely lost when it comes to scripting.
I've tried tutorials and nothing is getting through to me.

All I need is script that automatically grows a magic wand selection by 2 pixels, selects the below layer and fills the entire selection with the selected color. It sounds simple enough, but going about how to approach it is completely lost on me.

Is there someone willing to give me pointers or write the script for me? I don't want to sound lazy, but there is almost no chance of me understanding this.

Thanks so much! it should be doing what you're looking for.

I don't want to punish you for being so kind to dragongirl - but I am basically in the same boat. I actually managed to write a script which expanded my selection by 3 pixels, (by using basic elements copied out of other scripts) and installed it in my filter menu (I did get that far!). But I need a script which will do the following actions all in one step. (gimp-selection-grow img 3.0) (gimp-layer-select-top) - this is taken from the keyboard assignment description (gimp-edit-paste-into) (gimp-layer-select-bottom) in other words grow selection, then paste an image with that selection into the upper-most layer, and return to the lower layer (for the next selection). I have to do this about twenty times for 282 images (for one animation loop). I want to do at least ten versions of that loop. If I could combine these steps into a one button script, it would save me a lot of time (and pain). I have made several attempts to write a script that will do this - but I am lacking, and can't grasp the tutorials. ... If you (or anyone) can give me some tips, or point me to a basic model script that I could cannibalize, I would be more than grateful. Cheers, Gimp Newbie

;; Licensed to anyone for any purpose (define (sg-marq5 image layer) (let* ( (layers (gimp-image-get-layers image)) (top-layer (aref (cadr layers) 0)) (bot-layer (aref (cadr layers) (- (car layers) 1))) (float 0) ) (gimp-image-undo-group-start image) (gimp-selection-grow image 3) (set! float (car (gimp-edit-paste top-layer TRUE))) (gimp-floating-sel-anchor float) (gimp-image-set-active-layer image bot-layer) ) (gimp-displays-flush) (gimp-image-undo-group-end image) ) (script-fu-register "sg-marq5" "Paste Into Top" "Paste the current buffer into the top layer" "Saul Goode" "Saul Goode" "2009-12-02" "RGB*, GRAY*" SF-IMAGE "Image" 0 SF-DRAWABLE "Layer" 0 ) (script-fu-menu-register "sg-marq5" "/Edit")

That was fast! Thank you very much. I guess it just goes to show, that if your into it it's not that difficult. I wish I understood better what is going on in the script (the differences (and the whens and hows) between let*, set! and car - but I guess that is the meat of scripting) I had to change the (script-fu-menu-register "sg-marq5" "/Edit") to (script-fu-menu-register "sg-marq5" "/Edit") Script-fu didn't know where to put the script. Thank you once again. I hope that I can contribute to the forum soon too. let*,set!,car...let*,set!,car...let*,set!,car...aref,cadr,float. Gimp Newbie
Subscribe to Comments for "Can someone write a simple script for me?"