GIMP Script-fu

Update of "sg-sequential-edit"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: dcd928fabf1be2b89ab3aa71e8c51ca9ce3670e6
Page Name:sg-sequential-edit
Date: 2015-03-27 11:10:30
Original User: saulgoode
Parent: 2d7cc39de7a688182fed684358e3d33f60cfec54
Content
Command:
Sequential Edit
Menu:
"<Image>/File->Sequential Edit->Choose Files..."
"<Image>/File->Sequential Edit->Save and Open Next"
PDB Name:
script-fu-sg-sequential-open
script-fu-sg-save-and-next
Download:
sg-sequential-edit.scm (after the page appears, click on the "Download" command)
License:
GPLv2+

Description:

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 Choose Files... dialog and choosing all of the JPEG files (as an example) in a particular directory (by specifying *.jpg 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 Save and Open Next; 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:

"Choose Files..." 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 "Save and Open Next" 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.

Wildcard Patterns:

Multiple filenames/patterns can be supplied, separated by spaces.
wilber.png gavroche.png lena.jpg

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

frame_*.jpg

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

"Eiffel Tower.jpg" "wedding photos*.jpg"

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).

/home/sally/Pictures/*.png

The above filename/pattern forms can be combined.

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

Notes:

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 queued 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 not added to the existing queue.