GIMP Script-fu

Artifact Content

Artifact dcd928fabf1be2b89ab3aa71e8c51ca9ce3670e6:

Wiki page [sg-sequential-edit] by saulgoode 2015-03-27 11:10:30.
D 2015-03-27T11:10:30.812
L sg-sequential-edit
P 2d7cc39de7a688182fed684358e3d33f60cfec54
U saulgoode
W 4649
<dt><b>Command:</b> <dd>Sequential Edit</dd></dt>
<dt><b>Menu:</b> <dd>"<Image>/File->Sequential Edit->Choose Files..."</dd>
                 <dd>"<Image>/File->Sequential Edit->Save and Open Next"</dd></dt>
<dt><b>PDB Name:</b> <dd>script-fu-sg-sequential-open</dd>
<dt><b>Download:</b> <dd>[|sg-sequential-edit.scm] (after the page appears, click on the "Download" command)</dd></dt>
<dt><b>License:</b> <dd>[copyright|GPLv2+]</dd></dt>

<dt><b>Description:</b> <dd>This script will present a dialog that allows the user to queue up a set of files for sequential, one-at-a-time processing. A typical usage would have the user opening the <i>Choose Files...</i> dialog and choosing all of the JPEG files (as an example) in a particular directory (by specifying <b>*.jpg</b> for the filename wildcard pattern). The first file would then be opened, and when the user is done editing it, she would run the command <i>Save and Open Next</i>; repeating this process for each file matching the pattern.

WARNING: This script provides no confirmation dialog about overwriting the original file, nor does it warn about the image not being saved as an XCF file before the image is closed and the next one opened. The script is intended to optimize a specific workflow of making minor changes to many files sequentially. It is not intended for normal image editing workflows.

The script adds a new submenu, "File->Sequential Edit" containing two new commands:

<b>"Choose Files..."</b> presents a dialog which permits selecting the files that are to be queued up for editing. There are two components to this dialog. 

First, the user is able to select a base directory which contains the files, while the second is a list of filenames to be added to the queue. Wildcard patterns can be specified to match multiple files (e.g., *.jpg). The filename patterns should be separated by spaces, and any filename containing spaces should be place within double quotes. If an absolute path is provided, the base directory specified is ignored for that particular pattern. 

The <b>"Save and Open Next"</b> command will result in the file being saved back to the original location, overwriting the original file. The image is then closed and the next one in the queue opened.

<dt><b>Wildcard Patterns:</b> <dd>Multiple filenames/patterns can be supplied, separated by spaces. 

    <b>wilber.png gavroche.png lena.jpg</b>

An asterisk indicates that any string of characters should be considered a match.


If a filename/pattern contains any spaces then it should be placed within double quotes.

    <b>"Eiffel Tower.jpg" "wedding photos*.jpg"</b>

If a filename/pattern is an absolute path then the Directory specification will be ignored for that particular pattern (this feature not available on Windows).


The above filename/pattern forms can be combined.

    <b>wilber.png "Eiffel Tower.jpg" gavroche.png /home/sally/Pictures/*.png</b>

<dt><b>Notes:</b> <dd>Filenames/patterns must not contain colons. This means that Windows users can not use drive letters (C:, D: ...) for absolute filename/patterns. 

If the filename/pattern specification is empty then no files will be queued up. In general, filename extensions (.jpg, .png, .xcf...) should be used to avoid attempts at editing non-image files which result in annoying error messages.

Other images can be edited without interfering with the sequential editing queue, but note that the "Save and Open Next" command works on the <i>queued</i> image even if performed from a non-queued image. 

Edits to the current file can be abandoned merely by closing the image (using "File->Close View"). If there is no image open when "Save and Open Next" is performed then "Save and Open Next" will merely open the next file in the queue. 

If saving of the file fails (for example, owing to lack of overwrite permissions or lack of disk space), the unsaved image will remain open, an error report provided, and the next image in the queue opened. It is the responsibility of the user to save her changes using the normal "File->Export" process after fixing the problem.

If you quit GIMP, the sequential edit queue will not be available when you re-open it. 

Running "Choose Files" results in the edit queue being replaced by the chosen files, files are <b>not</b> added to the existing queue. </dd></dt>

Z 248a37866d0b4874639698f727431b00