RSS/Atom feed Twitter
Site is read-only, email is disabled

Automated sequence of actions with keyboard shortcuts? [SOLVED]

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

11 of 12 messages available
Toggle history

Please log in to manage your subscriptions.

Automated sequence of actions with keyboard short cuts? Dave M G 26 Feb 04:35
  Automated sequence of actions with keyboard short cuts? saulgoode@flashingtwelve.brickfilms.com 26 Feb 15:03
   Automated sequence of actions with keyboard shortcuts? [SOLVED] Dave M G 27 Feb 04:15
    Automated sequence of actions with keyboard shortcuts? [SOLVED] saulgoode@flashingtwelve.brickfilms.com 27 Feb 15:52
     Automated sequence of actions with keyboard shortcuts? [SOLVED] Dave M G 28 Feb 00:02
      Automated sequence of actions with keyboard shortcuts? [SOLVED] Sven Neumann 28 Feb 06:54
       Automated sequence of actions with keyboard shortcuts? [SOLVED] saulgoode@flashingtwelve.brickfilms.com 28 Feb 09:31
        Automated sequence of actions with keyboard shortcuts? [SOLVED] Sven Neumann 02 Mar 08:21
     Automated sequence of actions with keyboard shortcuts? [SOLVED] David Gowers 28 Feb 06:13
  Automated sequence of actions with keyboard short cuts? Joao S. O. Bueno Calligaris 26 Feb 17:46
45E26AE8.4040301@web.de 07 Oct 20:18
  Automated sequence of actions with keyboard short cuts? Dave M G 26 Feb 07:33
Dave M G
2007-02-26 04:35:10 UTC (about 17 years ago)

Automated sequence of actions with keyboard short cuts?

GIMP Users,

Because of the nature of my work, I have to repeat the same set of commands over and over again. These commands are:

1. Create a selection from a path (I don't know if there's a keyboard shortcut for this)
2. Select->Sharpen to remove any anti-aliasing (again, I don't know if there's a keyboard shortcut for this) 3. Fill with foreground colour ([ctrl+,]) 4. Deselect the selected area ([ctrl+shift+a], or [ctrl+d] under my current settings)
5. Delete the path (which I currently do by selecting a different tool and then selecting the path tool again - I'm sure there's a better way)

I do this over and over again as I colour an image, so if I could automate this process it would save me an immense amount of time, and probably prevent a lot of potential for human error.

When I did a Google search for possible solutions to this, I used the term "batch" processing. But in GIMP world this term is apparently used to refer to running multiple filters or other actions on a file from the command line by creating a script. That seems a little different from what I'm after. But I'm afraid my imagination for alternate terms is lacking, and I couldn't think of any terms that came up with what I was after.

Is there a way I can save a custom sequence of processes, and then, dare I hope, bind that sequence to a keyboard shortcut?

Thank you for any advice or information.

Dave M G
2007-02-26 07:33:03 UTC (about 17 years ago)

Automated sequence of actions with keyboard short cuts?

Claus,

Thank you for responding.

you could write a Script-Fu to do that.

Writing scripts looks kind of hard, as I'm not a programmer or coder by nature. But I'm game to try. So I read some of the pages you suggested, and also looked up a little info on the web.

I've worked out some of the commands I think I need from the "Procedure Browser", and then I looked at some other script files already installed on my machine to try and get some sense of the syntax. My first draft of the script is at the end of this message.

I'm confused on two points.

One is that the names of the procedures in the "Procedure Browser" don't seem to follow the same format as they do in the scripts in my scripts directory. In the scripts directory, they use dashes, "-" in their names, like "gimp-path-to-selection". But in the "Procedure Browser", they all use underscores, "_", like "gimp_path_to_selection". What should I be using?

The other is that the parameters often list as their first option to specify the image. For example, "gimp_path_to_selection", has this at the top of its list of parameters:
image IMAGE the image

Since I don't intend to be using this script at the command line, and will be using it on an image that I will have open in the GIMP GUI, do I need to specify this? Or do I need to use some kind of variable that specifies the currently active image?

Here is my first draft. If someone could help me make the syntax correct, then I think I could use it as a model for continuing to create my own scripts.

----- colour_flat.scm____

; Create anti-aliased colour flats from a path.

(define (colour_flat))

; Convert the path to a selection. (gimp_path_to_selection)

; Sharpen the selection to ensure it is not anti-aliased. (gimp_selection_sharpen)

; Fill the selected area with the current foreground colour. (gimp_edit_fill (GIMP_FOREGROUND_FILL (0)))

; Deselect the currently selected area. (gimp_selection_none)

; Remove the path. (gimp_path_delete)

-----file ends-----

Thank you for any assistance or advice.

saulgoode@flashingtwelve.brickfilms.com
2007-02-26 15:03:21 UTC (about 17 years ago)

Automated sequence of actions with keyboard short cuts?

Quoting Dave M G :

GIMP Users,

Because of the nature of my work, I have to repeat the same set of commands over and over again. (...SNIP...) Is there a way I can save a custom sequence of processes, and then, dare I hope, bind that sequence to a keyboard shortcut?

I had a few minutes free so I whipped up a script-fu which I think will do the task you described. I have even commented it so that you might see how it works (and perhaps modify it). I haven't tested the script on GIMP 2.2 (I am using a development version) so let me know if it doesn't work.

The command is not assigned to a keystroke but you can do so from the "File->Preferences->Interface->Configure keyboard shortcuts->Plugins" where you should click on the "Fill Path With FG" command and then hit the key you wish assigned.

NOTE: If you perform an UNDO after executing the command, you will no longer see the path because you won't be in "edit mode"; the path is still there but you will have to manually switch back to edit mode.

The script is available at:

http://www.flashingtwelve.brickfilms.com/GIMP/Scripts/Temp/fill-path.scm

Joao S. O. Bueno Calligaris
2007-02-26 17:46:54 UTC (about 17 years ago)

Automated sequence of actions with keyboard short cuts?

On Monday 26 February 2007 00:35, Dave M G wrote:

GIMP Users,

Because of the nature of my work, I have to repeat the same set of commands over and over again. These commands are:

1. Create a selection from a path (I don't know if there's a keyboard shortcut for this)
2. Select->Sharpen to remove any anti-aliasing (again, I don't know if there's a keyboard shortcut for this) 3. Fill with foreground colour ([ctrl+,]) 4. Deselect the selected area ([ctrl+shift+a], or [ctrl+d] under my current settings)
5. Delete the path (which I currently do by selecting a different tool and then selecting the path tool again - I'm sure there's a better way)

Hi Dave

I am in a bit of a hurry now, but tin the GIMP there are 2 ways of assigining shortcuts to any desired action .

Please, click in ->File->Prefrences and interface and read the instructions on "Dynamic Keyboard shortcuts" or just go from there to a shortcut assignment interface.

Also, you should consider makig a script - either in script-fu or gium-fu to repeat this sequence - it is actually easy, if you see some ofthe .py and .scm files taht come with the GIMP, and check the Procedure Database in ->Xtns->PDB Browser

Regards, js
->

I do this over and over again as I colour an image, so if I could automate this process it would save me an immense amount of time, and probably prevent a lot of potential for human error.

When I did a Google search for possible solutions to this, I used the term "batch" processing. But in GIMP world this term is apparently used to refer to running multiple filters or other actions on a file from the command line by creating a script. That seems a little different from what I'm after. But I'm afraid my imagination for alternate terms is lacking, and I couldn't think of any terms that came up with what I was after.

Is there a way I can save a custom sequence of processes, and then, dare I hope, bind that sequence to a keyboard shortcut?

Thank you for any advice or information.

Dave M G
2007-02-27 04:15:52 UTC (about 17 years ago)

Automated sequence of actions with keyboard shortcuts? [SOLVED]

Saul, Joao,

Thank you for replying.

saulgoode@flashingtwelve.brickfilms.com wrote:

I had a few minutes free so I whipped up a script-fu which I think will do the task you described. ...
The command is not assigned to a keystroke but you can do so from the "File->Preferences->Interface->Configure keyboard shortcuts->Plugins"

Wow! Thank you so much! I've downloaded, installed, and assigned a keyboard shortcut to the script, and it works exactly as I had hoped.

You've saved me a lot of work, so I really appreciate your effort.

The script looks quite complicated to me, but I will endeavor to use it as a model for building some other action sequences similar to this. Hopefully by changing just one or two things at a time I can get a feel for this and create more interesting scripts down the road.

Thank you Saul, and the GIMP users list, for all your support.

saulgoode@flashingtwelve.brickfilms.com
2007-02-27 15:52:33 UTC (about 17 years ago)

Automated sequence of actions with keyboard shortcuts? [SOLVED]

Quoting Dave M G :

The script looks quite complicated to me, but I will endeavor to use it as a model for building some other action sequences similar to this. Hopefully by changing just one or two things at a time I can get a feel for this and create more interesting scripts down the road.

The script appears complicated because it handles differences in the PDB interface between version 2.2 and the development version (perhaps my comments obfuscated the code as well). If the script only supported versions

(define (script-fu-path-fill-aliased image layer) (let* ((path (car (gimp-path-get-current image)))) (gimp-image-undo-group-start image) (gimp-path-to-selection image path CHANNEL-OP-REPLACE FALSE FALSE 0 0) (gimp-edit-bucket-fill layer FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0) (gimp-selection-none image)
(gimp-path-delete image path)
(gimp-displays-flush)
(gimp-image-undo-group-end image) )
)

Personally, I would recommend removing the line that deletes the path -- paths take up very little memory and you may wish to go back and edit them later.

Dave M G
2007-02-28 00:02:42 UTC (about 17 years ago)

Automated sequence of actions with keyboard shortcuts? [SOLVED]

Saul,

Thank you for continuing to help and explain.

The script appears complicated because it handles differences in the PDB interface between version 2.2 and the development version

Ah, I see. I had to look up "PDB Interface" to know what you're talking about, but now I get it.

Once version 2.4 is released, and if one were to write the code only to support 2.4 and later, and not worry about earlier versions, would that also simplify it down? I'm thinking if that were the case, then I might wait until 2.4 is out and then get more into scripting. After all, from what I've read on this mailing list, a 2.4 release seems just a little ways away.

(perhaps my comments obfuscated the code as well).

No, comments are good! The more comments the better, I think.

Personally, I would recommend removing the line that deletes the path -- paths take up very little memory and you may wish to go back and edit them later.

For what I'm doing, especially considering the volume of coloured areas I'm working with, I'm unlikely to every really need a path a second time.

But I'm developing a little confidence with the scripts, so that if I change my mind about that, I think I can easily remove that part of the script and have a second version that leaves the path there.

David Gowers
2007-02-28 06:13:30 UTC (about 17 years ago)

Automated sequence of actions with keyboard shortcuts? [SOLVED]

Hi,

On 2/28/07, saulgoode@flashingtwelve.brickfilms.com < saulgoode@flashingtwelve.brickfilms.com> wrote:

(define (script-fu-path-fill-aliased image layer) (let* ((path (car (gimp-path-get-current image)))) (gimp-image-undo-group-start image) (gimp-path-to-selection image path CHANNEL-OP-REPLACE FALSE FALSE 0 0)
(gimp-edit-bucket-fill layer FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
(gimp-selection-none image)
(gimp-path-delete image path)
(gimp-displays-flush)
(gimp-image-undo-group-end image) )
)

The script as defined above produces an antialiased fill, which is naturally the opposite of aliased (aliasing is stairstepping, and antialiasing counteracts it.). If an aliased (ie. hard-edged) rendering were preferable, (gimp-selection-sharpen image) would be needed before bucket filling.

Sven Neumann
2007-02-28 06:54:56 UTC (about 17 years ago)

Automated sequence of actions with keyboard shortcuts? [SOLVED]

Hi,

On Wed, 2007-02-28 at 08:02 +0900, Dave M G wrote:

Once version 2.4 is released, and if one were to write the code only to support 2.4 and later, and not worry about earlier versions, would that also simplify it down? I'm thinking if that were the case, then I might wait until 2.4 is out and then get more into scripting. After all, from what I've read on this mailing list, a 2.4 release seems just a little ways away.

You can write scripts for 2.2 now and continue to use them with future GIMP versions. The plug-in and scripting API is backwards compatible. I wonder why the example script even goes through the hassle of trying to deal with versions.

Sven

saulgoode@flashingtwelve.brickfilms.com
2007-02-28 09:31:55 UTC (about 17 years ago)

Automated sequence of actions with keyboard shortcuts? [SOLVED]

Quoting Sven Neumann :

You can write scripts for 2.2 now and continue to use them with future GIMP versions. The plug-in and scripting API is backwards compatible. I wonder why the example script even goes through the hassle of trying to deal with versions.

A valid point. I just dislike deprecation warnings popping up and I was rushing things a bit.

Quoting David Gowers :

The script as defined above produces an antialiased fill, which is naturally the opposite of aliased (aliasing is stairstepping, and antialiasing counteracts it.). If an aliased (ie. hard-edged) rendering were preferable, (gimp-selection-sharpen image) would be needed before bucket filling.

'gimp-selection-sharpen' is unnecessary because anti-aliasing was disabled (the argument set to FALSE) in the 'gimp-path-to-selection' call.

Sven Neumann
2007-03-02 08:21:30 UTC (about 17 years ago)

Automated sequence of actions with keyboard shortcuts? [SOLVED]

Hi,

On Wed, 2007-02-28 at 03:31 -0500, saulgoode@flashingtwelve.brickfilms.com wrote:

Quoting Sven Neumann :

You can write scripts for 2.2 now and continue to use them with future GIMP versions. The plug-in and scripting API is backwards compatible. I wonder why the example script even goes through the hassle of trying to deal with versions.

A valid point. I just dislike deprecation warnings popping up and I was rushing things a bit.

Just start gimp-2.3 with the --pdb-compat-mode=on command-line option then. The default for the unstable releases is to warn about deprecated functions being used. But this will of course change for stable releases and there will by default not be such warnings with gimp-2.4.

Sven