Re: [Gimp-user] interactive batch processing



On 12/9/18 7:50 PM, Gary Aitken wrote:
In the past I have interactively batch processed images via a shell script
that invokes gimp for each image.  This is both inconvenient and slow.
Inconvenient because there are parameters I need to enter into some python-fu
scripts that are the same for each of the images, and slow because of the
gimp startup and shutdown each time.

Is there a way to do one of the following:

A. Start gimp with a list of file names to process, and have it load only
   the first on the list.  Then when one quits or closes the image, load
   the next one, etc?

B. I can feed the list of file names to a python-fu script, which then can
   open and display the image.  Is there a way for a python-fu script to
   wait for, or be notified of, the closing of an image display? This
   would allow the script to effectively pause and allow processing before
   opening each successive image.  gimp-context-push/pop seem like they
   may somehow enable this but it's not clear to me how they are used.

It seems like gimp-display-get-window-handle might be useful somehow, if
there were a means to be notified when the window is destroyed.


A) my own ofn-file-next  script may help if the files are in some recognizable numerical sequence (IMG_678.JPG, IMG_679.JPG, IMG_690.JPG)(some holes in the sequence are allowed). You can assign it to some keyboard shortcut and it will export/close the current image, and load the next in the sequence. Typically you start Gimp, usin File>Ope, to open the first file in th eseqquence, and hit the shortcut to advance to the next file. Available here: <http://sourceforge.net/projects/gimp-tools/files/scripts/>.

This, combined with the "Repeat last filter" (Ctrl-F) (at the top of the "Filters" menu, repeats the last filter on the current image with the same parameters), should make you process your image sequence rather quickly (two keystrokes per image).

B) You can write a script that reads a list of files (or lists files in a directory), and loads each file, applies a filter, and saves the result. But you don't really change the behavior of the initial script. gimp_context_{push|pop} have nothing to do with this, they are used to save/restore the paint context (FG/BG colors, gradient, brush... etc). An example here: <https://stackoverflow.com/questions/44430081/how-to-run-python-scripts-using-gimpfu-from-windows-command-line/44435560#44435560>

There is also a "BIMP" Gimp plugin (the B is for "Batch") that is supposed to be able to run Gimp commands over a series of files. I don't know how well it supports a random filter.







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