[Gimp-user] Script Help - Basic Macro



You could try using the following function calls:

gimp-get-active-layer
gimp-layer-copy (returns the ID of the new layer)
gimp-set-active-layer (not sure if you will need this)
whatever functions you need to make the required changes
gimp-image-merge-down

To get started I would use the browse function in the console to get details of
the functions and their associated parameters (you can type part of what you are
looking for in the search box - for instance try just typing layer and see what
you get) but I would advise typing the script into a .scm (or .py) file rather
than having to keep entering data into the console - that saves time and typing.

Once you have made an edit to a .scm file you either have to restart GIMP to use
the new version of the file or use "Filters/Script Fu/Refresh Scripts"

The error messages can be a little cryptic but using gimp-message can help to
track down problems.

Look at the existing scripts in (on my PC) C:\Program Files\GIMP
2\share\gimp\2.0\scripts - search these files (or on the net) for the functions
you want to use. Possibly use one of the files as the basis for your own script.

I am looking to find some way to automate the following steps:

1) Duplicate the active layer, shifting focus to the duplicate (the
standard effect when selecting Layer>Duplicate layer)
2) Rotate the new active layer 180 degrees (Layer>Transform>Rotate
180)
3) Move the new active layer up 200 pixels
4) Merge the new active layer with the original active layer
(Layer>Merge Down)

Since this is just using existing functions within GIMP, it seems like
this should be a simple script to make, however, when testing out the
functions I think I need in the interactive consoles (I've tried this
with both the python console and the script-fu console) All I get are
errors, the functions seem to want the NAME of the layer being
manipulated, even the function to GET the layer name.

I've worked with script files both in Microsoft environments and in
*nix, I just need to figure out how to make this work in a GIMP
environment.  All of the script tutorials I've seen for GIMP seem to
be either designed around automated script-writing software ("First
write the pseudocode like this, then run it through this program which
you can no longer find at the other end of this broken link") or they
seem to be talking about a higher level programming language, writing
what looks like mangled C code for 'hello world' programs.

Any help that can be provided would be greatly and humbly appreciated.

-- 
programmer_ceds (via www.gimpusers.com/forums)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]